Yii-CMS is a content management system based on Yii 2.0. It is a standard Yii 2.0 project. Its project structure is similar to the Advanced Project Template. If you are proficient in Yii 2.0, you can use Yii-CMS to meet your needs. If not, start here.
- Create and manage pages, posts, and multilevel menus.
- Design URLs to be SEO-friendly.
- Manage edit permissions.
- Multi-site and multilingual support.
- Import data from WordPress.
- PHP 7.4.0 or higher.
- MySQL/MariaDB or PostgreSQL.
- Initialize the application by running the
initcommand:php init - Modify the configuration item db in the file path-to-yii-cms/common/config/main.php. The database must be created, and the user must be granted all privileges.
- Configure the webserver's webroot directory to path-to-yii-cms/site1/web for site-domain-name.
- Open site-domain-name/install.php in your browser.
- Initialize the application by running the
initcommand within a container:docker compose run --rm site1 php /app/init - Modify the configuration item db in the file path-to-yii-cms/common/config/main.php according to the settings in the file path-to-yii-cms/docker-compose.yml (
'dsn' => 'mysql:host=mysql;dbname=site1'). - Start the application:
docker compose up -d - Open http://localhost:8000/install.php in your browser.
After the installation is successfully completed, you can delete install.php.
Create a new layout in a path-to-yii-cms/site-name/views/layouts directory. Create a new site in the admin panel with the following parameters:
- Url: a new url (
example.com). - Language: a new language.
- Layout: a new layout.
Modify the configuration item isMultiLanguageEnabled in a file path-to-yii-cms/site-name/config/params.php.
The URL example when isMultiLanguageEnabled is set to true:
example.com/en/about
The URL example when isMultiLanguageEnabled is set to false:
example.com/about
Create a new site in the admin panel with the following parameters:
- Url: same as a default site/a new language (
example.com/en). - Language: a new language.
- Layout: same as a default site.
If needed, add a new language directory in a path-to-yii-cms/site-name/messages directory.
- Open a console terminal and run the following command:
/path/to/php-bin/php /path/to/yii-application/yii-cms create-site --name=new-site-name --site=source-site-name
The example:
php yii-cms create-site --name=example_com --site=site1
- Configure the webserver's webroot directory to path-to-yii-cms/new-site-name/web for new-site-domain-name.
- Open new-site-domain-name/admin/site in your browser.
- Create a new site in the admin panel.
In the admin panel, you can only see websites that have the same Directory as the current directory (basename(Yii::$app->basePath))).
The RBAC permissions are in the file common/modules/admin/rbac/Permission.php.
Add a new permission as is shown below:
const MY_PERMISSION = 'My permission description';Get all permissions:
foreach (Permission::getConstants() as $key => $value) {
}