This Project Template is another skeleton Yii 2 for creating projects.
The template contains the basic features including user sign in/up and a password recovery page., (*1)
, (*2)
DIRECTORY STRUCTURE
app
assets/ contains application assets such as JavaScript and CSS
config/ contains application configurations
controllers/ contains Web controller classes
forms/ contains Web form classes
messages/ contains message translation
runtime/ contains files generated during runtime
views/ contains view files for the Web application
web/ contains the entry script and Web resources
widgets/ contains GUI widgets
common
config/ contains shared configurations
entities/ contains etities classes
jobs/ contains jobs (tasks)
mail/ contains view files for e-mails
messages/ contains shared messages (core)
migrations/ contains database migrations
repositories/ contains classes for working with the database
services/ contains services classes
console
commands/ contains console controllers
config/ contains console configurations
runtime/ contains files generated during runtime
tests
runtime/ contains files generated during runtime
unit/ contains unit tests
vendor/ contains dependent 3rd-party packages
REQUIREMENTS
- PHP >= 7.0
- PHPUnit >= 6.0 (for tests running only)
- Bower
- Npm
- Gulp
INSTALLATION
Install via Composer
If you do not have Composer, you may install it by following the instructions
at getcomposer.org., (*3)
You can then install this project template using the following command:, (*4)
php composer.phar create-project --prefer-dist variarty/yii-tempate app
cd app
npm install
bower install
Web resources building
Gulp is used to build web resources (css, js, etc.). Gulp has several tasks:, (*5)
gulp help task (get available tasks with description)
gulp less transform app less to css
gulp js copy app JS to dist directory
gulp bootstrap build Twitter Bootstrap with custom overrides
gulp build run `less`, `js`, `bootstrap` tasks
gulp watch watch resources src directory and run 'build' task on change
Phing usage
If you have Phing you can run phing
in your application directory. Phing will run the commands:, (*6)
composer install
npm install
bower install
gulp build
TESTING
Tests are located in tests
directory. They are developed with PHPUnit. Tests can be executed by running, (*7)
phpunit
The command above will execute unit tests. Now, unit tests are testing only entities., (*8)