Skip to content

hujuice/Mini-REST-JSON-Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

PURPOSE
=======
Have a easy-to-use REST-JSON Framework for PHP

CONCEPTS
========
If you have a data repository, simply write a class to read its data.
Then, extend the class to have an __invoke method reading some $params.
    $params will come grom $_GET.
Also, extend the class to have a __construct method, reading some config.
See the example to learn more.

INSTALL
=======
Have the RestJson.php file somewhere.
Prepare a ws.php (or the name you like) in your htdocs dir.
Include the RestJson.php file.
Create a RestJson object, giving it a configuration path.
Run the ->run() method of the RestJson object.
See the example to learn more.

CONFIGURATION
=============
[service]
model, the model class/file name, mandatory
modelPath, the model path, optional, (default "../model")
max-age, if > 0 will give a "Cache-Control: cache, must-revalidate, max-age=seconds" header, else a "Cache-Control: no-cache" header, optional (default 0)
debug, if true have a more detailed error reporting, optional (default false)

[config]
everything to be passed to the model

See the example to learn more.

WORKING EXAMPLE
===============
Try to run:
http://rest-json.inservibile.org/members.php?action=planet&planet=Uranus
http://rest-json.inservibile.org/members.php?action=humans

About

Create a simple REST_JSON service from a class

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages