freefri / cake-rest-api
CakePHP Rest API
Installs: 2 193
Dependents: 11
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=7.4 || >=8.0
- ext-json: *
- ext-mbstring: *
- bshaffer/oauth2-server-php: ~1.14
- cakephp/cakephp: ^4.4
- cakephp/migrations: ^3.2
- composer/composer: ^2.0
- eduplex-api/cake-api-swagger: ^0.1.4
- symfony/service-contracts: ^2.5.3
Requires (Dev)
- cakephp/cakephp-codesniffer: 4.*
- freefri/cake-rest-api-fake-app: ^0.1.2
- phpunit/phpunit: ~8.5.0 || ^9.3 || ^10.1
Suggests
- phpstan/phpstan: PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code.
- dev-main
- 0.5.18
- 0.5.17
- 0.5.16
- 0.5.15
- 0.5.14
- 0.5.13
- 0.5.12
- 0.5.11
- 0.5.10
- 0.5.9
- 0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.26
- 0.3.25
- 0.3.24
- 0.3.23
- 0.3.22
- 0.3.21
- 0.3.20
- 0.3.19
- 0.3.18
- 0.3.17
- 0.3.16
- 0.3.15
- 0.3.14
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
This package is auto-updated.
Last update: 2024-11-07 15:16:00 UTC
README
Rest API for CakePHP 4.x
Configuration
-
Some configuration can be done using env variables (search for
env(
in the project to find usages). -
Some configuration when working with plugins can be done from the main configuration (
config/app.php
file).- Using the key
Swagger
is optional, but can be helpful to customize some directories (search forread('Swagger
for details) - As sibling from the main
App
configuration use the namespace of the plugin followed by the wordPlugin
.
- Using the key
For example, if your plugin namespace is called Example, create the following config file:
return [
'debug' => false,
'App' => [ ... ],
'Swagger' => [ ... ]
'ExamplePlugin' => [
'tablePrefix' => 'example_',
'routePath' => '/api/v1',
],
];
The following configuration can be used:
tablePrefix
: (optional) in case you want to add a prefix for you database tables, e.g.myplugin_users
. Can be empty string.routePath
: Definition for the beginning of the path for all routes in the plugin
Swagger
In order to make swagger UI with openapi description available, a new controller SwaggerJsonController
must be
created, with the corresponding route definition. The method getContent
can be overwritten in this controller
in order to add customization for the main spec info (title, description, version, etc.). Swagger generation can be
configured as described in the Configuration section above.
In any controller test the function $this->skipNextRequestInSwagger()
can be used to do not add the next request.
License
The source code for the site is licensed under the MIT license, which you can find in the LICENSE file.