Download the PHP package sawarame/php-json-server without Composer
On this page you can find all versions of the php package sawarame/php-json-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-json-server
php-json-sever
php-json-server
is RESTful API with PHP. The data can be wrote json format, and you can easily set up RESTful API mock server.
Installation and Startup
Use Composer for installation and server start-up.
Once installed, You can startup php-json-server
with PHP build-in server.
Then visit the site at http://localhost:8080/. If the welcome page is displayed, installation and startup are successful.
Prepare data
Save data file in the path below.
The schema_name
of file name is used to data name. The data name can be any name, and multiple datas can be saved under different name. There is a sample.json
in the initial state.
Data must wrote by array of json format. Data structure is arbitrary, but id
column is required.
Read data
To get the data named schema_name
, access below URL with GET method.
Default data rows per page is 20. if you want to change it, use rows
parameter.
How to change page is use page
parameter.
You can search by using the column name as the parameter.
Normally, When multiple parameters are specified, the search will be an AND condition.
If you want to search with OR condition, use or
to search_type
parameter.
Response header
The response header contains information about paging.
name | description |
---|---|
PJS-Total: | Total number of datas. |
PJS-pages: | Total number of pages. |
PJS-Rows: | Rows of current page. |
Find row
Example below receive the data that id
column value is 123.
Insert row
Use POST method for insert data.
Created data will be returned.
Update row
Use PUT method for update data.
Updated data will be returned.
Delete row
Use DELETE method for delete data.
Deleted data will be returned.
All versions of php-json-server with dependencies
laminas/laminas-component-installer Version ^2.4
laminas/laminas-development-mode Version ^3.2
laminas/laminas-mvc Version ^3.1.1
components/jquery Version ^3.4
components/bootstrap Version ^4.4