sahil-gulati/apibase

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

Utility for creating light weight API's

1.0.0 2021-10-16 09:48 UTC

This package is auto-updated.

Last update: 2025-01-16 21:45:49 UTC


README

Utility for creating light weight API's

Installation

composer require sahil-gulati/apibase

Example

<?php

require_once 'vendor/autoload.php';

# Register routes
APIBase\URL\Router::registerRoutes("/api/v1", array(
    array(
        METHOD => "GET",
        ROUTE => "/payments",
        HANDLER => "helloWorld"
    )
));

# Process request
APIBase\URL\Invoker::processRequest();

function helloWorld(){
    echo json_encode(array("message" => "Hello from sahil!"));
}

Test

localhost:80/api/v1/payments