Skip to content

Simple RESTful API in PHP, easy to import and set up. It handles all the main types of http requests using a RESTful approach. Designed for SQL database.

License

Notifications You must be signed in to change notification settings

SandroMaglione/PHP-RESTful-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP RESTful API

Twitter: SandroMaglione

Simple RESTful API in PHP, easy to import and set up. It handles all the main types of http requests using a RESTful approach. Designed for SQL database.

Getting started

All the main functionalities come from the /config/database.php file. You first need to add your configuration parameters at the beginning of this file.

Then you will create an object file in the /objects directory. This file will be the class from which you will write and run all the queries related to the object itself. The file needs a $conn variable and a constuctor to initialize the connection to the database (check out /objects/collection.php for a concrete example). You will then write all your queries into their own functions.

Finally, you should create a directory with the same name of the object. Each file inside this directory will be an endpoint for your api calls. You should take a look at the /collection/get-all-collection.php file for an example on how to structure the file. You first import the config files (the object and the type of request config file (GET, POST, PUT[update], DELETE). Then you retrieve the call parameters and launch the query from the object file. The api will respond based on the result received from the database.

Built with

  • PHP 7.0

Versioning

  • v1.0.0 - 03 September 2019

Author

  • Sandro Maglione

License

GNU General Public License v3.0, see the LICENSE.md file for details.

About

Simple RESTful API in PHP, easy to import and set up. It handles all the main types of http requests using a RESTful approach. Designed for SQL database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages