PHP code example of rnd-cosoft / api-tools-rest
1. Go to this page and download the library: Download rnd-cosoft/api-tools-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/ */
rnd-cosoft / api-tools-rest example snippets
return [
/* ... */
'modules' => [
/* ... */
'Laminas\ApiTools\Rest',
],
/* ... */
];
'AddressBook\\V1\\Rest\\Contact\\Controller' => [
'listener' => 'AddressBook\\V1\\Rest\\Contact\\ContactResource',
'route_name' => 'address-book.rest.contact',
'route_identifier_name' => 'contact_id',
'collection_name' => 'contact',
'entity_http_methods' => [
0 => 'GET',
1 => 'PATCH',
2 => 'PUT',
3 => 'DELETE',
],
'collection_http_methods' => [
0 => 'GET',
1 => 'POST',
],
'collection_query_whitelist' => [],
'page_size' => 25,
'page_size_param' => null,
'entity_class' => 'AddressBook\\V1\\Rest\\Contact\\ContactEntity',
'collection_class' => 'AddressBook\\V1\\Rest\\Contact\\ContactCollection',
'service_name' => 'Contact',
],
'service_manager' => [
'invokables' => [
'Laminas\ApiTools\Rest\RestParametersListener' => 'Laminas\ApiTools\Rest\Listener\RestParametersListener',
],
'factories' => [
'Laminas\ApiTools\Rest\OptionsListener' => 'Laminas\ApiTools\Rest\Factory\OptionsListenerFactory',
],
],
'controllers' => [
'abstract_factories' => [
'Laminas\ApiTools\Rest\Factory\RestControllerFactory',
],
],
'view_manager' => [
// Enable this in your application configuration in order to get full
// exception stack traces in your API-Problem responses.
'display_exceptions' => false,
],