infotechnohelp / cakephp-dev-utilities
Developing utilities for CakePHP 3
Requires
- cakephp/cakephp: ^3.7
- symfony/yaml: ^4.2
- vlucas/phpdotenv: ^2.4
Requires (Dev)
- doctrine/instantiator: 1.0.*
- phpunit/phpunit: ^5.7|^6.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-10-22 23:48:02 UTC
README
PLUGIN/composer.json
Change "name" value
Replace All in Path PLUGIN
Infotechnohelp\CakeDevUtilities → AnyPluginName
new-title → any-plugin-name
Load plugin
Add this line to APP/config/bootstrap.php
Plugin::load('AnyPluginName', ['routes' => true]);
Migrate tables into APP
CakePHP 3+ APP root
$ bin/cake migrations migrate --plugin AnyPluginName
API layer
Prefix any-plugin-name/api
In order to send request to PLUGIN/src/Controller/Api/MyPluginController→getById()
,
use this path:
any-plugin-name/api/my-plugin/get-by-id
Tests
Run tests (Plugin root)
vendor/bin/phpunit
In order to use plugin's fixtures in APP/tests
, add this to APP/composer.json
"autoload-dev": {
"psr-4": {
... ,
"AnyPluginName\\Test\\": "./vendor/philsweb/cakephp-plugin-skeleton/tests",
}
},
composer dump-autoload
Sniff
Fix (Plugin root)
./sniff -f
Check for conflicts (Plugin root)
./sniff
PLUGIN/config/.env
export DB_TEST_HOST = localhost
export DB_TEST_NAME = test
export DB_TEST_USERNAME = root
export DB_TEST_PASSWORD =