The following is a proposed project structure for basic applications that works in conjunction with YIInitializr components.
YIInitializr vanilla projects make extensive use of Composer. We found at 2amigos.us that is easier to your extensions bundle outside of your application scope - thanks to Phundament and Tobias Munk for his knowledge and shares. Composer is your dependency package best friend.
The package is cleaned from extensions, you choose what you wish to include in your composer.json files. The only ones included are Yii Framework (obviously), YiiStrap and YiiWheels, the rest is up to you. We do not want to confuse you
Setup and first run
- Set up Git by following the instructions here.
- Update the configurations in
app/config/to suit your needs. The
common/config/main.phpis configured to use sqllite by default. Change your
common/config/env/dev.phpto suit your database requirements.
- Composer is required The package includes already a
- Browse through the
composer.jsonand remove the dependencies you don't need also update the required versions of the extensions.
- If you have
composer self-updateto make sure you have the latest version of composer.
composer installto download all the dependencies.
- If you work the
composer.pharlibrary within the project boilerplate.
php composer.phar self-updateto make sure you have the latest version of composer.
php composer.phar installto download all the dependencies.
Yiinitializr\Composer\Callbackwill configure everything required on your application:
assetsfolders and migrations.
For more information about using Composer please see its documentation.
###How to configure the application
We focused to release the pain of configuring your application and combine your configuration files.
Yiinitializr\Helpers\Initializr is very easy to use, check for example the bootstrap
require('./../app/lib/vendor/yiisoft/yii/framework/yii.php'); Yii::setPathOfAlias('Yiinitializr', './../app/lib/Yiinitializr'); use Yiinitializr\Helpers\Initializer; Initializer::create('./../app', 'main', array('common', 'env', 'local'))->run();
For more information about Yiinitializr please check it at its github repo.
Bellow the directory structure used:
|-app |---cli |-----commands |-----migrations |---config |-----env |---controllers |---extensions |-----behaviors |-----components |---helpers |---lib #it will hold composer 'vendor' folder |-----Yiinitializr |-------Cli |-------Composer |-------Helpers |-------config |---messages |---models |---modules |---views |-----layouts |-----site |---widgets |-www |---css |-----fonts |---img |---js |-----libs
The following extensions are part of YIInitializr-basic template:
- Yiistrap https://github.com/yii-twbs/yiistrap
- Yiiwheels https://github.com/2amigos/yiiwheels
- Yiinitializr https://github.com/2amigos/yiinitializr
web development has never been so fun