PHP Classes

Easy API: Handle API calls by mapping requests to functions

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 185 All time: 8,656 This week: 455Up
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: 8 packages by
Country: Colombia Colombia
Innovation award
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 &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 (27)  
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 (27)  /  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 (27)  /  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 (27)  /  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 (27)  /  config  /  vendor  /  firebase  
File Role Description
Files folder imagephp-jwt (3 files, 1 directory)

  Files folder image Files (27)  /  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 (27)  /  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 (27)  /  html  
File Role Description
  Accessible without login HTML file index.html Doc. Documentation

  Files folder image Files (27)  /  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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:185
This week:0
All time:8,656
This week:455Up