PHP Classes

Easy API: Handle API calls by mapping requests to functions

Recommend this page to a friend!
  Info   View files Example   View files View files (27)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 185 This week: 1All time: 8,645 This week: 560Up
Version License PHP version Categories
easyapi 1.0.0GNU General Publi...5PHP 5, Web services
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.

Picture of Luis Toscano
  Performance   Level  
Name: Luis Toscano <contact>
Classes: 7 packages by
Country: Colombia Colombia
Age: 37
All time rank: 249714 in Colombia Colombia
Week rank: 411 Up2 in Colombia Colombia Up

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 &amp; 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


  Files folder image Files  
File Role Description
Files folder imageconfig (3 files, 1 directory)
Files folder imagehtml (1 file)
Files folder imagelibs (3 files)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file api.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  config  
File Role Description
Files folder imagevendor (1 file, 2 directories)
  Accessible without login Plain text file config.php Aux. Auxiliary script
  Plain text file easyAuth.php Class Class source
  Accessible without login Plain text file _bootstrap.php Example Example script

  Files folder image Files  /  config  /  vendor  
File Role Description
Files folder imagecomposer (8 files)
Files folder imagefirebase (1 directory)
  Accessible without login Plain text file autoload.php Aux. Auxiliary script

  Files folder image Files  /  config  /  vendor  /  composer  
File Role Description
  Accessible without login Plain text file autoload_classmap.php Aux. Auxiliary script
  Accessible without login Plain text file autoload_namespaces.php Aux. Auxiliary script
  Accessible without login Plain text file autoload_psr4.php Aux. Auxiliary script
  Plain text file autoload_real.php Class Class source
  Plain text file autoload_static.php Class Class source
  Plain text file ClassLoader.php Class Class source
  Accessible without login Plain text file installed.json Data Auxiliary data
  Accessible without login Plain text file LICENSE Lic. License text

  Files folder image Files  /  config  /  vendor  /  firebase  
File Role Description
Files folder imagephp-jwt (3 files, 1 directory)

  Files folder image Files  /  config  /  vendor  /  firebase  /  php-jwt  
File Role Description
Files folder imagesrc (4 files)
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file LICENSE Lic. License text
  Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  config  /  vendor  /  firebase  /  php-jwt  /  src  
File Role Description
  Plain text file BeforeValidException.php Class Class source
  Plain text file ExpiredException.php Class Class source
  Plain text file JWT.php Class Class source
  Plain text file SignatureInvalidException.php Class Class source

  Files folder image Files  /  html  
File Role Description
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files  /  libs  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file mixing.class.php Class Class source
  Plain text file orm.class.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:185
This week:1
All time:8,645
This week:560Up