There is no license information available for the latest version (dev-master) of this package.

Pacote para criação de seridor rest

dev-master 2018-09-06 18:51 UTC

This package is auto-updated.

Last update: 2024-11-18 04:13:09 UTC


README

Pequena classe para criar use server rest

Server

$_HEAD = [
    // Obrigario
    'verbo' => 'METHOD', // GET | POST | PUT | DELETE
    
    // Opcional
    'login' => $_SERVER['PHP_AUTH_USER'],
    'password' => $_SERVER['PHP_AUTH_PW'],
];

$_DATA = [];

$api = '\Teste\Teste';

$api = new $api();

$apiReturn = $api->request($_HEAD, $_DATA);

Comando

namespace Teste;
use Rest\Rest;

class Teste extends Rest{
    
    // confere o login do usuario
    protected function auth($_HEAD, $_DATA = []){
    
        // $_HEAD['login'] 
        // $_HEAD['password']
         
        return true;
    }

    protected function POST($_DATA){
        // Cria o registro no sistemna
    }
}