gCore

gCore · APIManager

REST routing, a middleware pipeline, and endpoint registration with rate-limiting and CORS.

Part of gCore · first-party Base manager (full implementation — no Pro)

What it is

APIManager provides a REST layer: register endpoints with method + path + handler, compose a middleware pipeline (auth, rate-limit, CORS), and run either as a standalone HTTP server or integrated into an existing request lifecycle.

Usage

$api = $gCore->getService('api');   // aliases: 'rest', 'APIManager'

$api->addMiddleware('auth', fn($req) => $req);   // your auth check

$api->registerEndpoint('GET', '/v1/orders/{id}', function ($req) {
    return ['id' => $req['id'], 'status' => 'paid'];
}, ['middleware' => ['auth']]);

$api->processRequest();   // dispatch the current HTTP request

Public API

Full generated index: PUBLIC_API.mdAPIManager. At a glance:

Behavior & limits

Contract

Integration detail: CONTRACT.md §2.5. The universal ModuleInterface lifecycle applies here as to every manager.


Disclaimer

This software is provided "as is", without warranty of any kind, express or implied. Use of this software is entirely at your own risk. In no event shall the author or contributors be held liable for any damages arising from the use or inability to use this software.

Built by Niels Erik Torensupport the work.