Skip to content

Yii-CMS is a content management system based on Yii 2.0

License

Notifications You must be signed in to change notification settings

klsoft-web/yii2-cms

Repository files navigation

Yii-CMS

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.

Features

  • 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.

The system requirements

  1. PHP 7.4.0 or higher.
  2. MySQL/MariaDB or PostgreSQL.

Installation

Installing manually

  1. Initialize the application by running the init command:
    php init
  2. 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.
  3. Configure the webserver's webroot directory to path-to-yii-cms/site1/web for site-domain-name.
  4. Open site-domain-name/install.php in your browser.

Installing using Docker

  1. Initialize the application by running the init command within a container:
    docker compose run --rm site1 php /app/init
  2. 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').
  3. Start the application:
    docker compose up -d
  4. Open http://localhost:8000/install.php in your browser.

After the installation is successfully completed, you can delete install.php.

Create a new site with the same directory

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.

Enable/Disable multilingual support for a site

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

Add a new language for a site

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.

Creating a new site with a new directory

  1. 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

  1. Configure the webserver's webroot directory to path-to-yii-cms/new-site-name/web for new-site-domain-name.
  2. Open new-site-domain-name/admin/site in your browser.
  3. Create a new site in the admin panel.

Accessibility of site content editing

In the admin panel, you can only see websites that have the same Directory as the current directory (basename(Yii::$app->basePath))).

Configuring the RBAC permissions

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) {
}

About

Yii-CMS is a content management system based on Yii 2.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published