Yii2 project template with multilanguage mode, based on Yii2 basic framework.
Project is available to install at Git Hub repository.
This template includes:
-
Admin panel, based on AdminLTE
-
Ability to content manage with some number of languages.
-
Number of entities, which are managed by admin panel:
- Languages
- Site settings (Initial role and status after registration, e.t.c.)
- Users
- RBAC (Set roles and permissions for users)
- Positions
- Pages
- Products (child products for pages)
- Feedback
- About (about company page)
- Technologies (child)
- Qualities (child)
- Contacts
- Social (child)
- Home page
- Site map
This template helps you to easy start your Yii2 project. And then you can change it as you wish.
- php >= 7.1
- composer
- MySql >= 5.5
-
Clone project.
SSH SOURCE: git@github.com:itstructure/yii2-template-multilanguage.git
HTTPS SOURCE: https://github.com/itstructure/yii2-template-multilanguage.git
-
Install dependencies by running from the project root
composer install
-
Copy file
config/base-url_example.php
toconfig/base-url.php
. In fileconfig/base-url.php
set a project host:return 'http://example-host.com';
-
You can set the environment options. For that, copy file
config/environment_example.php
toconfig/environment.php
. In fileconfig/environment.php
set the next:define('YII_DEBUG', true); define('YII_ENV', 'dev');
or
define('YII_DEBUG', false); define('YII_ENV', 'test');
If to not set this options, then by default:
YII_DEBUG
is false,YII_ENV
is prod. -
Create new data base.
-
Copy file
config/db_example.php
toconfig/db.php
. In fileconfig/db.php
set settings according with the access to MySql server.Example:
return [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=yourdbname', 'username' => 'root', 'password' => 'passwordvalue', 'charset' => 'utf8', ];
-
Run the RBAC migration:
yii migrate --migrationPath=@yii/rbac/migrations
-
Run the command to build initial rbac entities:
yii build-rbac
Roles and permissions will be created with the following structure:
|--------------------|-----------------------------| | | Roles | | |-----------------------------| | Permissions | admin | manager | user | |--------------------|---------|---------|---------| | CREATE | X | | | | UPDATE | X | | | | DELETE | X | | | | SET_ROLES | X | | | | VIEW_BACKSIDE | X | X | | | VIEW_FRONTSIDE | X | X | X | |--------------------|---------|---------|---------|
-
Run multilanguage migration:
yii migrate --migrationPath=@admin/migrations/multilanguage
-
Run MFU module migration:
yii migrate --migrationPath=@mfuploader/migrations
-
Run the application migration:
yii migrate
-
If you are going to use google captcha, copy file
config/captcha_example.php
toconfig/captcha.php
. In fileconfig/captcha.php
it is necessary to set captcha params:return [ 'site_key' => 'your-google-site-key', 'secret_key' => 'your-google-secret-key', ];
And uncomment
captcha
option inconfig/params.php
config file. -
If you are going to load some files to Amazon S3 remote storage by MFUploader module, it is necessary to set AWS access params in new
config/aws-credentials.php
config file.Copy file
config/aws-credentials_example.php
toconfig/aws-credentials.php
and set:return [ 'key' => 'your-aws-s3-key', 'secret' => 'your-aws-s3-secret', ];
And uncomment
s3-upload-component
option of themfuploader
module option inconfig/admin/admin.php
config file.Comment or delete
local-upload-component
option.Then set
'defaultStorageType' => MFUModule::STORAGE_TYPE_S3