photon/api-json

Views helper to create REST APIs with JSON and CORS

v1.4.0 2020-10-20 13:35 UTC

This package is auto-updated.

Last update: 2024-12-20 22:42:51 UTC


README

Views helper to create REST APIs

Quick start

  1. 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"
  1. 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
	);
  }
}
  1. Enjoy !