czahoo / api-framework
Basic light weight framework for external or internal APIs
v1.1.12
2017-06-23 13:20 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- curl/curl: ^1.2
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- dev-master / 1.0.x-dev
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.7-alpha
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0
- v1.0-beta
- v0.1.0-alpha
- dev-fixForEmptyResponseFlag
This package is not auto-updated.
Last update: 2024-04-27 16:08:44 UTC
README
After installing module using composer, you need to follow steps below:
- Add content of src/.htaccess to your .htaccess file or just copy it to your root directory if u don't have one
- Create basic folder for your API (by default it should be named 'Api')
- Create application folder inside your Api (by default it should be named 'App')
- Create Routing.php file where you put your routing config with basic structure as defined below:
- Implement 'show' method in your basic controller which will be called by default if no other method is passed
- Create index.php file with code as presented below
- To call default method in your basic controller type yoursitename.com/api/ (for external api) or yoursitename.com/internal_api/ (for internal api)
- To call method 'test' in your custom controller for internal api type yoursitename.com/api/custom_route/test
File: index.php
// Register vendor autoloader require_once '../vendor/autoload.php'; // Start application session_start(); Framework::detectContext($_GET['API_TYPE']); Framework::translateUrl($_GET['URL']); Framework::run();
File: Routing.php
$FRAMEWORK_ROUTING = array( Framework::API_TYPE_EXTERNAL => array( Framework::DEFAULT_CONTROLLER_ROUTE_NAME => 'Api\App\Basic\Controller\BasicControllerName', 'custom_route' => 'Api\App\Path\To\Your\Controller', ), Framework::API_TYPE_INTERNAL => array( Framework::DEFAULT_CONTROLLER_ROUTE_NAME => 'Api\App\Basic\Controller\BasicControllerName', ), );