Skip to content

this template use for use yii as micro service or in GCP app engine

License

Notifications You must be signed in to change notification settings

taufiqrahman/yii2-micro-service

Repository files navigation

Yii2 Micro Service Template


Yii 2 Micro Service is a skeleton Yii 2 application best for developing complex Web Service with RBAC feature. it is suitable for backend mobile application.

DIRECTORY STRUCTURE

components/         contains Web components classes
controllers/        contains Web controller classes
models/             contains model classes
modules/            contains modules classes
tests/              contains various tests for the basic application
vendor/             contains dependent 3rd-party packages
web/                contains the entry script and Web resources
console/            contains Console app to help you build model with gii console

USAGE

  1. Clone this repo
  2. Running composer install / update
  3. Edit file /console/config/main.php for DB connection
  4. Run migration
    ./yii migrate/up 1
    
  5. Create RBAC table
    ./yii migrate --migrationPath=@yii/rbac/migrations/
    
  6. Run migration again
    ./yii migrate
    
  7. rename env-example to .env
  8. Edit .env to configure your environment
  9. Run your application

SAMPLE USER

You can try this user :

username : admin
password : P4ssw0rd
OR
username : testuser
password : testuserP455

RUNNING

You can run it from the micro-app/ directory via:

./yii serve --docroot=./web

SAMPLE RBAC

You can try RBAC with user login first. Then try access v1/auth-test Admin can access page : v1/auth-test, where testuser can't.

CREATING MODEL WITH GII CONSOLE

Because no web UI in this framework, we can use gii console. First one first edit console app in /console/config/main.php to connect to DB source. and run this command:

./yii gii/model --tableName=table_name --modelClass=class_name

Model Class will exist in /console/models directory. You can find detail about gii here

About

this template use for use yii as micro service or in GCP app engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages