Skip to content

itstructure/yii2-template-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 simple template install documentation

Scrutinizer Code Quality Build Status

1 Introduction

Yii2 simple project template, based on Yii2 basic framework. Project is available to install at Git Hub repository.

This template includes:

  • Admin panel, based on AdminLTE

  • Number of entities, which are managed by admin panel:

    • Site settings (Initial role and status after registration, e.t.c.)
    • Users
    • RBAC (Set roles and permissions for users)
    • Positions
    • Pages
      • Articles (child articles for pages)
    • Categories
      • Products (child products for categories)
    • 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 like.

2 Requirements

  • php >= 7.1
  • composer
  • MySql >= 5.5

3 Installation

  1. Clone project.

    SSH SOURCE: [email protected]:itstructure/yii2-template-simple.git

    HTTPS SOURCE: https://github.com/itstructure/yii2-template-simple.git

  2. Install dependencies by running from the project root composer install

  3. Copy file config/base-url_example.php to config/base-url.php. In file config/base-url.php set a project host:

    return 'http://example-host.com';
  4. You can set the environment options. For that, copy file config/environment_example.php to config/environment.php. In file config/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.

  5. Create new data base.

  6. Copy file config/db_example.php to config/db.php. In file config/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',
    ];
  7. Run the RBAC migration:

    yii migrate --migrationPath=@yii/rbac/migrations

  8. 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    |
     |--------------------|---------|---------|---------|
    
  9. Run MFU module migration:

    yii migrate --migrationPath=@mfuploader/migrations

  10. Run the application migration:

    yii migrate

  11. If you are going to use google captcha, copy file config/captcha_example.php to config/captcha.php. In file config/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 in config/params.php config file.

  12. 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 to config/aws-credentials.php and set:

    return [
        'key' => 'your-aws-s3-key',
        'secret' => 'your-aws-s3-secret',
    ];

    And uncomment s3-upload-component option of the mfuploader module option in config/admin/admin.php config file.

    Comment or delete local-upload-component option.

    Then set 'defaultStorageType' => MFUModule::STORAGE_TYPE_S3

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published