This is example project implementing CRUD application created to help people learn Yii 2.0. It was created during my graduation project performed in Yekaterinburg, Russia. So application language is only Russian. The project showing how to deal with Gii, grids, filtering and other Yii 2.0 usage. It may contain bugs and etc.
It is built on top of basic Yii 2.0 template.
assets/ Assets definition
commands/ Console commands (controllers)
config/ Application configurations
controllers/ Web controller classes
docker/ Docker related files
models/ Model classes
runtime/ Files generated during runtime
views/ View files for the Web application
web/ The entry script and Web resources
widgets/ Custom user created widgets
Please notice that the application is currently running in development mode.
That can slow down the performance on Windows (because of xdebug).
Docker (Desktop) and Docker compose.
You can install Docker Desktop on Windows and MacOS, or Docker CE on Linux, but on Linux you must also install Docker Compose.
The following commands will be using Composer trough Docker.
You can then install the application using the following command:
git clone https://github.com/f1amy/renovation-of-apartments.git
docker run --rm -it -v ${PWD}:/app -v composer-cache:/tmp composer:1.8 install
After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.
- Run command
docker-compose build
to build PHP service with necessary extensions. - Run command
docker-compose up -d
to launch the application in detached console mode.
The next step is to load database using scripts in docker/mysql/scripts
directory. You can do that using Adminer:
docker run --rm -it -p 8080:8080 --network="reofap-net" -e ADMINER_DEFAULT_SERVER=mysql adminer:4.7
Then Adminer will be available at localhost:8080
.
Use the following data to login:
- Login: mysql.
- Password: 157266.
- Database: renovation_of_apartments.
Click at SQL-command
button on the top left.
Put there text firstly from create tables.sql
, then test values.sql
.
And finally we must initialize RBAC using the following command:
docker exec -it php-fpm ash .docker/mysql/rbac-init.sh
Answer yes
and the application will be available at localhost
.
To login into the application, you should use the following credentials:
LOGIN PASSWORD
head-of-accounting acc0unt
brigadier ch1ef
brigade-worker-1 work-1
brigade-worker-2 work-2
brigade-worker-3 work-3
brigade-worker-4 work-4
brigade-worker-5 work-5
The users are having different rights:
- head-of-accounting role has all rights to the application.
- brigadier role can't create records to many tables.
- brigade-worker can only view some tables.
You can stop application using command docker-compose down
.
And launch again using docker-compose up
.