Yii2 Start Project Basic Template
The application is built using basic pattern and has a modular structure.
Pages
Modules
Functional
The template includes the of the CSS Theme Bootstrap
Switching the theme occurs in the app/config/web.php
The minimum requirement by this project template that your Web server supports PHP 5.6
Create a project:
composer create-project --prefer-dist --stability=dev dominus77/yii2-basic-start basic-project
or clone the repository for pull
command availability:
git clone https://github.com/Dominus77/yii2-basic-start.git basic-project
cd basic-project
composer install
Init an environment:
Run command in the root directory public_html
of the project
if Development environment
composer app-init-dev
if Production environment
composer app-init-prod
otherwise choose Wednesday
php init
Create a database, default configure: yii2_basic_start
in app/config/common-local.php
$config = [
//...
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_start',
//...
],
//...
],
//...
];
Apply migration:
composer migrate-up
Create users, enter the command and follow the instructions:
php yii users/user/create
See all available commands:
php yii
When initialized, the user with ID:1 is assigned the SuperAdmin role.
composer rbac-init
A command to assign roles to other users:
php yii rbac/roles/assign
To untie:
php yii rbac/roles/revoke
You can then access the application through the following URL:
http://localhost/basic-project/web/
Create .htaccess
file or add folder app/web
AddDefaultCharset utf-8
# Mod_Autoindex
<IfModule mod_autoindex.c>
# Disable indexes
Options -Indexes
</IfModule>
# Mod_Rewrite
<IfModule mod_rewrite.c>
# Enable symlinks
Options +FollowSymlinks
# Enable mod_rewrite
RewriteEngine On
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
</IfModule>
composer check-style
Create a database, default configure yii2_basic_start_test
in app/config/test-local.php
$config = [
//...
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_start_test',
//...
],
//...
],
//...
];
Apply migration:
composer migrate-test-up
composer build
composer test
The BSD License (BSD). Please see License File for more information.