A skeleton for creating applications with CakePHP 4.x.
All code is licensed under MIT License
Run from docker-compose:
docker-compose -f ./docker-compose-dev.yml up -d
Connect as root to the database launched using docker-compose (e.g. you can run exec on the container from nginx) and create a new default db for the project
(check config/app_local.php file for the credentials)
Connect to the nginx container using exec and run composer (do not run as root, but in order to set folder permissions root may be needed)
cd /var/www/cplatform/public/app_rest/
su composeruser
composer install
Connect via ssh to dockerssh@localhost:2222 and the password: password
The local path is the location of this readme file and it should be mapped to /var/www/cplatform/public
When running test use /var/www/cplatform/public/app_rest/phpunit.xml.dist as default configuration file.
Also add /var/www/cplatform/public/app_rest/vendor/autoload.php as a default autoload file
- Connect to the container using exec
- Navigate to the main path with
cd /var/www/cplatform/public/app_rest - Avoid running commands as root (since it can cause permission problems), change the user with:
su composeruser
You can run tests using phpunit command: vendor/bin/phpunit -c ../app_rest/phpunit.xml.dist
But using an IDE is desirable (e.g. PhpStorm)
Generate test coverage with: vendor/bin/phpunit --coverage-html ./webroot/coverage/*
Migrations should be the only way to perform changes in the database schema
More info about phinx and the migration plugin on cake book
# create a new migration called 'CreateUsers'
bin/cake bake migration CreateUsers
# execute the migration on the db
bin/cake migrations migrate
# revert the migration on the db
bin/cake migrations rollback