combc/yii2boilerplate

Structure for enterprise-grade websites for Yii2 framework.


Keywords
framework, boilerplate, vagrant, yii2
License
MIT

Documentation

Yii2 Boilerplate

Structure for enterprise-grade websites for Yii2 framework.

Easiest initial deploy ever

  1. Install Vagrant.

  2. Install Virtualbox.

  3. If you have PHP 5.4+ installed already, you've just installed all prequisites for YiiBoilerplate.

  4. Now just clone the Yii2Boilerplate repo:

    git clone git@github.com/combc/Yii2-Boilerplate.git <yourprojectname>
    
  5. Create your own github personal API tokens https://github.com/blog/1509-personal-api-tokens. Paste it into a Vagrantfile.

    Example:

    s.args   = [
       #YOUR GITHUB TOKEN HERE
       "d1d8c6a9e9b706a596b96b9994bf0549109083ba",
       ...
    ]
    

    Note: Yii2Install

  6. Inside cloned directory run and wait for complete:

    vagrant up
    
  7. You're done. Open up the http://yii2frontend.dev:8080/. It's your future frontend. Open up http://yii2backend.dev:8080/. It's your future backend. You can start working.

  8. Change the origin repo to the new repository in order to push your new project:

     git remote remove origin  
     git remote add origin <NEW-GIT-REMOTE>
    

    Don't forget to vagrant halt the virtual machine before turning off your workstation, virtualbox can fail to shut itself down in time before kill -9 arrives.

Yii 2 Advanced Application Template

Yii2Boilerplate uses Yii 2 Advanced Application Template is a skeleton Yii 2 application best for developing complex Web applications with multiple tiers.

Vagrant config

Database

You can select up data between MySQL 5.6 and Postgres 9.3. Enter the Vagrantfile name of the database, default mysql.

Example:

    s.args   = [
        ...
        #YOUR DATABASE TYPE HERE [mysql|pgsql]
        "pgsql"
    ]

If you have chosen MySQL:

PhpMyAdmin adress: http://localhost:8080/phpmyadmin/

If you have chosen Postgres:

PhpPgAdmin adress: http://localhost:8080/phppgadmin/

Database default credential:

login: vagrant

password: vagrant

database: yii2boilerplate

database for tests: yii2boilerplate_tests

MailCatcher

MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface.

smtp://0.0.0.0:1026

http://0.0.0.0:1081

Default common/config/main-local.php:

    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        'viewPath' => '@common/mail',
        'useFileTransport' => false,
    ],

Virtual Machine config

Use the vagrantfile to the desired options of memory and cpu.

DEFAULT: memory = 1024 MB, cpus = 2

    config.vm.provider "virtualbox" do |v|
            #v.memory = 512
            #v.cpus = 1

            v.memory = 1024
            v.cpus = 2
    end

More http://docs.vagrantup.com/v2/virtualbox/configuration.html

XDebug conf

XDebug SessionId: XDEBUG

XDebug port 9000

On run configuration:

    Project URL: http://yii2backend.dev:8080/
    Index file: backend/web/index.php
    
    or
    
    Project URL: http://yii2frontend.dev:8080/
    Index file: backend/web/index.php

The installed

License

And of course:

MIT: LICENSE

====

ComBC
http://combc.eu