Yii2 Start Project Basic Template
, (*1)
The application is built using basic pattern and has a modular structure., (*2)
Base components
Pages
- Home
- About
- Contact
- Check in
- Login
- Profile, (*3)
Modules
- main
- users
- admin
- rbac (manage web interface), (*4)
Functional
- Reset password
- Confirmation by email
- Last visit
- Console commands
- RBAC, (*5)
CSS Themes Bootstrap
The template includes the of the CSS Theme Bootstrap, (*6)
Switching the theme occurs in the app/config/web.php
, (*7)
Requirements
The minimum requirement by this project template that your Web server supports PHP 5.6, (*8)
INSTALLATION
Create a project:, (*9)
composer create-project --prefer-dist --stability=dev dominus77/yii2-basic-start basic-project
or clone the repository for pull
command availability:, (*10)
git clone https://github.com/Dominus77/yii2-basic-start.git basic-project
cd basic-project
composer install
Init an environment:, (*11)
Run command in the root directory public_html
of the project, (*12)
if Development environment, (*13)
composer app-init-dev
if Production environment, (*14)
composer app-init-prod
otherwise choose Wednesday, (*15)
php init
Create a database, default configure: yii2_basic_start
in app/config/common-local.php
, (*16)
$config = [
//...
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_start',
//...
],
//...
],
//...
];
Apply migration:, (*17)
composer migrate-up
Create users, enter the command and follow the instructions:, (*18)
php yii users/user/create
- Username: set username;
- Email: set email username;
- Password: set password username (min 6 symbol);
- Status: set status username (0 - blocked, 1 - active, 2 - wait, ? - Help);
See all available commands:, (*19)
php yii
Initialize RBAC
When initialized, the user with ID:1 is assigned the SuperAdmin role., (*20)
composer rbac-init
A command to assign roles to other users:, (*21)
php yii rbac/roles/assign
To untie:, (*22)
php yii rbac/roles/revoke
You can then access the application through the following URL:, (*23)
http://localhost/basic-project/web/
Create .htaccess
file or add folder app/web
`, (*24)
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>
Code Sniffer
composer check-style
TESTING
Create a database, default configure yii2_basic_start_test
in app/config/test-local.php
, (*25)
$config = [
//...
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_start_test',
//...
],
//...
],
//...
];
Apply migration:, (*26)
composer migrate-test-up
Run in console
composer build
composer test
License
The BSD License (BSD). Please see License File for more information., (*27)