1. Go to this page and download the library: Download mixerapi/cakephp-rest library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mixerapi / cakephp-rest example snippets
# src/Application.php
public function bootstrap(): void
{
// other logic...
$this->addPlugin('MixerApi/Rest');
}
# config/routes.php
$routes->scope('/', function (RouteBuilder $builder) {
// ... other routes
(new AutoRouter($builder))->buildResources();
// ... other routes
});
# in your plugins/{PluginName}/routes.php file
(new AutoRouter($builder, new ResourceScanner('MyPlugin\Controller')))->buildResources();