https://github.com/juan-morales/silex_api
Project schema to create a PHP Silex Project (REST APIs) using an Services-Controller architecture and JSON responses.
https://github.com/juan-morales/silex_api
controller json json-response php php-silex service silex webapp
Last synced: about 2 months ago
JSON representation
Project schema to create a PHP Silex Project (REST APIs) using an Services-Controller architecture and JSON responses.
- Host: GitHub
- URL: https://github.com/juan-morales/silex_api
- Owner: juan-morales
- Created: 2017-06-26T16:02:54.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-26T16:09:43.000Z (almost 9 years ago)
- Last Synced: 2025-03-11T13:42:09.665Z (over 1 year ago)
- Topics: controller, json, json-response, php, php-silex, service, silex, webapp
- Language: PHP
- Homepage: http://www.jcmcv.com
- Size: 1.65 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README #
General project schema to create a PHP Silex Project (REST APIs) using an Services-Controller architecture and JSON responses.
### Main Idea ###
* 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.
### What is this repo for? ###
* Project Schema in order to create a Services-Controller driven REST API webapp using PHP/Silex.
* JSON responses.
* Version 1.0
### Test Routes - They are all POST URLs
+ Hello World -parameter: name
> > #### http://localhost/silex_api/web/index.php/api/v1/helloworld
+ Create a Product in DB -parameter: product_name
> > #### http://localhost/silex_api/web/index.php/api/v1/product/create
+ Update a Product in DB -parameter: product_id, product_name
> > #### http://localhost/silex_api/web/index.php/api/v1/product/update
+ Delete a Product in DB -parameter: product_id
> > #### http://localhost/silex_api/web/index.php/api/v1/product/delete
+ Select a Product or all products in DB -parameter: product_id or null
> > #### http://localhost/silex_api/web/index.php/api/v1/product/
### Install ###
* Copy this folder project into your "htdocs"
* Change your DataBase parameters in app.php
* Use your favorite API Client like:
* POSTMAN
* Advanced REST Client.
### Dev/Prod ###
* To create predefined settings in webapp environments (Dev & Prod), check the files in:
* ./resources/config
### Main WebApp code ###
* The main code of the app is in the ./src directory. Feel free to modify anything.
### Check Points ###
* Dont forget to enable/disable the "//CORS SECTION" in the main app.php file.