Skip to content

Sinevia/php-library-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Library API

Tests Gitpod Ready-to-Code

A package to quickly set a PHP webservice

Background

Installation

  • Install via Composer
composer require sinevia/php-library-api

Usage

  1. The lines bellow create an API service, which serves commands mapped to middleware and class methods:
$commands = [
    'ping' => 'PingController@ping',
    
    'auth/login' => 'AuthController@login',
    'auth/register' => 'AuthController@register',
    'auth/password-restore' => 'AuthController@passwordRestore',
    
    'account/password-change' => ['MiddlewareController@verifyUser','AccountController@passwordChange'],
    
];

$api = new Sinevia\ApiService;
$api->addCommands($commands);
die($api->run());
  1. Example controller with response:
class PingController{
    function ping(){
        return (new Sinevia\ApiResponse)->success('pong');
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages