dominus77/yii2-basic-start

Yii2 Start Project Basic Template

Fund package maintenance!
Patreon

Installs: 53

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 2

Forks: 2

Open Issues: 0

Type:project

1.0.0 2018-02-27 14:22 UTC

This package is auto-updated.

Last update: 2021-11-25 17:43:53 UTC


README

Latest Stable Version License build Scrutinizer Code Quality Code Intelligence Status Total Downloads

The application is built using basic pattern and has a modular structure.

Base components

Pages

  • Home
  • About
  • Contact
  • Check in
  • Login
  • Profile

Modules

  • main
  • users
  • admin
  • rbac (manage web interface)

Functional

  • Reset password
  • Confirmation by email
  • Last visit
  • Console commands
  • RBAC

CSS Themes Bootstrap

The template includes the of the CSS Theme Bootstrap

Switching the theme occurs in the app/config/web.php

Requirements

The minimum requirement by this project template that your Web server supports PHP 5.6

INSTALLATION

Create a project:

composer create-project --prefer-dist --stability=dev dominus77/yii2-basic-start basic-project

or clone the repository for pull command availability:

git clone https://github.com/Dominus77/yii2-basic-start.git basic-project
cd basic-project
composer install

Init an environment:

Run command in the root directory public_html of the project

if Development environment

composer app-init-dev

if Production environment

composer app-init-prod

otherwise choose Wednesday

php init

Create a database, default configure: yii2_basic_start in app/config/common-local.php

$config = [
    //...
    'components' => [
        'db' => [
            'dsn' => 'mysql:host=localhost;dbname=yii2_basic_start',
            //...
        ],
        //...
    ],
    //...
];

Apply migration:

composer migrate-up

Create users, enter the command and follow the instructions:

php yii users/user/create
  • Username: set username;
  • Email: set email username;
  • Password: set password username (min 6 symbol);
  • Status: set status username (0 - blocked, 1 - active, 2 - wait, ? - Help);

See all available commands:

php yii

Initialize RBAC

When initialized, the user with ID:1 is assigned the SuperAdmin role.

composer rbac-init

A command to assign roles to other users:

php yii rbac/roles/assign

To untie:

php yii rbac/roles/revoke

You can then access the application through the following URL:

http://localhost/basic-project/web/

Create .htaccess file or add folder app/web `

AddDefaultCharset utf-8
# Mod_Autoindex
<IfModule mod_autoindex.c>
  # Disable indexes
  Options -Indexes
</IfModule>

# Mod_Rewrite
<IfModule mod_rewrite.c>
  # Enable symlinks
  Options +FollowSymlinks
  # Enable mod_rewrite
  RewriteEngine On

  # If a directory or a file exists, use the request directly
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  # Otherwise forward the request to index.php
  RewriteRule . index.php
</IfModule>

Code Sniffer

composer check-style

TESTING

Create a database, default configure yii2_basic_start_test in app/config/test-local.php

$config = [
    //...
    'components' => [
        'db' => [
            'dsn' => 'mysql:host=localhost;dbname=yii2_basic_start_test',
            //...
        ],
        //...
    ],
    //...
];

Apply migration:

composer migrate-test-up

Run in console

composer build
composer test

License

The BSD License (BSD). Please see License File for more information.