photon / api-json
Views helper to create REST APIs with JSON and CORS
Installs: 482
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/photon/api-json
Requires
- php: ^7.0
- photon/photon: ^2.0
Requires (Dev)
- phpunit/phpunit: ^5.0
- squizlabs/php_codesniffer: ^3.2
README
Views helper to create REST APIs
Quick start
- Add the module
Use composer to add the module in your project
composer require "photon/api-json:dev-master"
or for a specific version
composer require "photon/api-json:1.0.0"
- Create an API Endpoint
Each class will handle all HTTP methods for an URL
class MyAPIEndpoint extends \photon\views\APIJson\Rest
{
public function GET($request, $match)
{
return array(
'ok' => true,
'method' => $request->method
);
}
}
- Enjoy !