Ratings | | Unique User Downloads | | Download Rankings |
Not yet rated by the users | | Total: 185 | | All time: 8,656 This week: 455 |
|
Description | | Author |
This package can be used to handle API calls by mapping requests to given functions.
It can take arrays with the names of functions that will be called when API requests are sent to URLs with the same names of the functions.
Those functions that care of outputting the response to the API requests eventually encoding the responses in JSON format. | |
|
|
Innovation award
Nominee: 1x
Winner: 1x |
|
Example
<?php
/*
___ ______ _____ _ _ ___ ___
/ _ \| ___ \_ _| | | | | | \/ |
/ /_\ \ |_/ / | | | | ___ ___ | | _| . . | ___
| _ | __/ | | | | / _ \ / _ \| |/ / |\/| |/ _ \
| | | | | _| |_ | |___| (_) | (_) | <| | | | __/
\_| |_|_| \___/ \_____/\___/ \___/|_|\_\_| |_/\___|
*/
////// Definitions
//include 'config/config.php';
define('LIBS', 'libs');
$qs = $_SERVER['QUERY_STRING'];
$config = ['appserver' => 'ionic', 'jwtenabled' => true];
$factory = array();
$library = array(
'mixing' => '',
'orm' => $link
);
////// SimpleCore
include 'config/_bootstrap.php';
include 'config/easyAuth.php';
////// Security Actions
$onlypost = array('save','get');
////// Actions Zone
function hello(){
GLOBAL $factory;
echo '?? lol ??';
}
function halo(){
echo '?? aloh ??';
}
function trucks($json = false){
if($json == 'json'){
echo json_encode(factory(null, 'orm')->query("SELECT * FROM trucks"));
}else{
echo factory(null, 'orm')->toTable("SELECT * FROM trucks");
}
}
function save($data = array()){
GLOBAL $factory;
echo 'Saving Data '.$data['ipclient'];
factory(null, 'orm')->insert(array('tabla' => 'look_track', 'reg' => array('ip'=>$data['ipclient'], 'hostname'=>$data['hostname'])));
}
////// Simple Execute API
runner();
|
Details
EasyApi
The Custom Pack for Develoment Apis by PHP Mixed ( Functional & OOP )
Easy & Custom pack for develoment api and microservices based in PHP, use a mixed programing techniques - Functional and OOP
For Testing.
- Edit Config file for database conections.
- Place any libraries to use in libs forlder
- Add a classname in the array at the api.php file
- Runn Runn and Test.
- Edit EasyAuth.php in the config folder, change $secret, this variable is the seed of security encrypt
My Powers
- Friendly with Ionic Apps.
- Fast.
- Add Your Power.
- JWT Support - New
Notices for JWT
Request to jwtgenerate for generate the token, this token have a TTL by default in one hour.
EasyApi Use
- PHP
- MySQL
- OOP
- Functional Programing
- Factory Pattern
- Object Injected
- Routing Dinamic
- JWT for PHP
Beauty V0 Beta. jejeje
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.