composer require sprintcube/cakephp-rest
composer require sprintcube/cakephp-rest
bin/cake plugin load -b Rest
$routes->connect('/foo/bar', ['controller' => 'Foo', 'action' => 'bar', 'isRest' => true]);
namespace App\Controller\Api;
use Rest\Controller\RestController;
class ProductsController extends RestController
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->response->cors($this->request)
->allowOrigin('*')
->allowMethods(['GET', 'PUT', 'POST', 'OPTIONS'])
->allowHeaders(['X-CSRF-Token'])
->allowCredentials()
->maxAge(300)
->build();
}
Also in PHP:
- eamble php erorors
- check a word in a string
- create foreign key laravel migration
- composer takes older version of php
- create project laravel 6
- In AbstractMySQLDriver.php line 128: An exception occurred in driver: could not find driver
- Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/service.ramondettiforwarding.com/lib/vendor/guzzlehttp/guzzle/src/Middleware.php on line 3432184904
- create new record via model in laravel
- array key sort unique laravel
- display date format in php
- basic php
- display php erros
- artisan make auth
- check if string contains letter php
- cacert.pem file_get_contents openssl
- clear cache with code laravel
- count php string
- add php var to js console log
- check number is divisible by 3 php
- create random_str laravel
- check if key exist in php
- Dijkstra’s algorithm php
- add errors php
- ** (process:82385): CRITICAL **: 22:54:20.169: string_replace: assertion 'self != NULL' failed