Aplikasi ini dibuat untuk {ganti sendiri}.
assets/ contains assets definition
config/ contains application configurations
console/ contains console commands (controllers)
controllers/ contains Web controller classes
environments/ contains environment-based overrides
helpers/ contains useful helper classes
mail/ contains view files for e-mails
migrations/ contains all migration files
models/ contains model classes
runtime/ contains files generated during runtime
tests/ contains various tests for the basic application
themes/ contains application view layout template
vendor/ contains dependent 3rd-party packages
views/ contains view files for the Web application
web/ contains the entry script and Web resources
The minimum requirement by this project that your Web server supports PHP 8.1 and MariaDB 10.
-
Add useful extension/module
-
Separated project state, whether you choose for development or production state
-
API template ready to use
Install neccesary package :
composer install
Initiate project state, choose project state you want to use, 0
for development, and 1
for production :
php init
Ope file config/components.php
, and change dbname
, username
and password
, for example:
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'schemaMap' => [
'mysql' => SamIT\Yii2\MariaDb\Schema::class
],
'dsn' => 'mysql:host=localhost;dbname=db_name',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
],
]
];
Run migration for RBAC :
php yii migrate --migrationPath=@yii/rbac/migrations
Run migration for RBAC Management :
php yii migrate --migrationPath=@mdm/admin/migrations
Run migration for the rest of application :
php yii migrate
Run this to add admin user, change username
and password
with you like :
php yii config/tambah-admin username password
You can then access the application through the following URL :
http://localhost/yii2-basic
Generate API key if you want to use it :
php yii config/generate-api-key 'config/api-local.php'
You can then access API endpoint through the following URL :
http://localhost/yii2-basic/api/v1