-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
39 lines (33 loc) · 1.25 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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