General project schema to create a PHP Silex Project (REST APIs) using an Services-Controller architecture and JSON responses.
-
Having a code Schema, ready to Add Services and Controllers.
-
In one Controller, you may use many Service Methods.
-
Example:
-
Create Services for Users
-
Create Services for Sessions
-
Then you can have Controllers, that use the services to manage users and sessions and another ones depending on the pourpuse of the Controller.
- Project Schema in order to create a Services-Controller driven REST API webapp using PHP/Silex.
- JSON responses.
- Version 1.0
- Hello World -parameter: name
- Create a Product in DB -parameter: product_name
- Update a Product in DB -parameter: product_id, product_name
- Delete a Product in DB -parameter: product_id
- Select a Product or all products in DB -parameter: product_id or null
- Copy this folder project into your "htdocs"
- Change your DataBase parameters in app.php
- Use your favorite API Client like:
- POSTMAN
- Advanced REST Client.
- To create predefined settings in webapp environments (Dev & Prod), check the files in:
- ./resources/config
- The main code of the app is in the ./src directory. Feel free to modify anything.
- Dont forget to enable/disable the "//CORS SECTION" in the main app.php file.