ustadev/yii2basic

Yii 2 Basic Project Template. This project is being developed by Jamshidbek Akhlidinov

v1.0.6 2024-06-01 06:53 UTC

This package is auto-updated.

Last update: 2024-12-17 10:48:37 UTC


README

Yii 2 Basic Project Template


Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

The template contains the basic features including user login/logout and a contact page. It includes all commonly used configurations that would allow you to focus on adding new features to your application.

Latest Stable Version Total Downloads wakatime

DIRECTORY STRUCTURE

- yii2basic
|
|-----assets/             contains assets definition
|----- commands/           contains console commands (controllers)
|----- config/             contains application configurations
|----- controllers/        contains Web controller classes
|----- mail/               contains view files for e-mails
|----- models/             contains model classes
|----- modules/            contains admin module and others modules
|          |- admin/        admin module
|          |  |- modules/
|              |-- content/             post,page,post category
|              |-- file/                file management
|              |-- landing element/     frontend view management
|              |-- rbac/
|          |- restapi/       rest api module
|              modules/
|                  v1/
|----- runtime/            contains files generated during runtime
|----- tests/              contains various tests for the basic application
|----- vendor/             contains dependent 3rd-party packages
|----- views/              contains view files for the Web application
      web/                contains the entry script and Web resources

REQUIREMENTS

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

INSTALLATION

Install via Composer

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

You can then install this project template using the following command:

composer create-project ustadev/yii2basic

Now you should be able to access the application through the following URL, assuming basic is the directory directly under the Web root.

http://localhost/basic/web/

Install from an Archive File

Extract the archive file downloaded from yiiframework.com to a directory named basic that is directly under the Web root.

Set cookie validation key in config/web.php file to some random secret string:

'request' => [
    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
    'cookieValidationKey' => '<secret random string goes here>',
],

You can then access the application through the following URL:

http://localhost/basic/web/

CONFIGURATION

Database

config/db.php copy config/db_locale.php and setting this file

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => 'rooot',
    'charset' => 'utf8mb4',
];

or .env.dist file copy .env file and settings

YII_DEBUG="true"
YII_ENV="dev"

APP_NAME="Admin Panel"

DB_DSN="mysql:host=localhost;dbname=yii2basic"
DB_USERNAME="root"
DB_PASSWORD="root"
DB_CHARSET="utf8mb4"


BOT_TOKEN="token"

MAIL_FROM_EMAIL="mail@gmail.com"
MAIL_FROM_NAME="Name"
MAIL_HOST="smtp.gmail.com"
MAIL_PASSWORD="password"

NOTES:

  • Yii won't create the database for you, this has to be done manually before you can access it.
  • Check and edit the other files in the config/ directory to customize your application as required.
  • Refer to the README in the tests directory for information specific to basic application tests.

Runing project

php yii serve
php8.1 yii serve