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.gitHTTPS 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.phptoconfig/base-url.php. In fileconfig/base-url.phpset a project host:return 'http://example-host.com';
-
You can set the environment options. For that, copy file
config/environment_example.phptoconfig/environment.php. In fileconfig/environment.phpset 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_DEBUGis false,YII_ENVis prod. -
Create new data base.
-
Copy file
config/db_example.phptoconfig/db.php. In fileconfig/db.phpset 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-rbacRoles 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.phptoconfig/captcha.php. In fileconfig/captcha.phpit is necessary to set captcha params:return [ 'site_key' => 'your-google-site-key', 'secret_key' => 'your-google-secret-key', ];
And uncomment
captchaoption inconfig/params.phpconfig 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.phpconfig file.Copy file
config/aws-credentials_example.phptoconfig/aws-credentials.phpand set:return [ 'key' => 'your-aws-s3-key', 'secret' => 'your-aws-s3-secret', ];
And uncomment
s3-upload-componentoption of themfuploadermodule option inconfig/admin/admin.phpconfig file.Comment or delete
local-upload-componentoption.Then set
'defaultStorageType' => MFUModule::STORAGE_TYPE_S3

