Yii 2 Minimal Console Application Template is a skeleton Yii 2 application best for starting totally from scratch, especially for console application.
It includes all commonly used configurations that would allow you to focus on adding new features to your console application.
commands/ contains console commands (controllers)
config/ contains application configurations
models/ contains model classes
runtime/ contains files generated during runtime
vendor/ contains dependent 3rd-party packages
The minimum requirement by this application template that your Web server supports PHP 7.4.0.
If you do not have Composer, you may install it by following the instructions at getcomposer.org.
You can then install this application template using the following command:
composer create-project --prefer-dist --stability=dev agungsijawir/yii2-minimal-console path/to/your/project
Now you should be able to run the application through the command line / terminal:
./yii
Edit the file config/db.php
with real data, for example:
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yii2minimal',
'username' => 'root',
'password' => '1234',
'charset' => 'utf8',
];
NOTES:
- Yii won't create the database for you, this has to be done manually before you can access it.
- Check and edit the other files in the
config/
directory to customize your application as required. - Follow best practice as detailed and clear explanation on The Definitive Guide to Yii 2.0 - Section: Console applications.
This project is forked from samdark/yii2-minimal and yii2
community.
Forked stripped out web view and just for console only.