zeeshanmushtq / apinexa
File-first API schema engine for Laravel with runtime registry, OpenAPI generation and signed API keys.
1.0.7
2026-06-23 07:16 UTC
Requires
- php: ^8.3
- illuminate/cache: ^11.0|^12.0
- illuminate/console: ^11.0|^12.0
- illuminate/contracts: ^11.0|^12.0
- illuminate/filesystem: ^11.0|^12.0
- illuminate/http: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- phpunit/phpunit: ^11.5
This package is not auto-updated.
Last update: 2026-06-24 03:13:59 UTC
README
File-first API schema engine for Laravel. Define APIs in PHP, compile a runtime registry, generate OpenAPI + HTML docs, and protect endpoints with stateless signed API keys.
Requirements
- PHP 8.3+
- Laravel 11 or 12
Installation
composer require zeeshanmushtq/apinexa php artisan apinexa:install
Quick Start
- Add a schema file in
api-nexa/schemas/:
<?php return [ 'name' => 'Create Job', 'method' => 'POST', 'endpoint' => '/jobs', 'auth' => true, 'roles' => ['admin', 'employer'], 'scopes' => ['jobs:create'], 'payload' => [ 'title' => 'required|string', 'salary' => 'nullable|numeric', ], ];
- Compile schemas:
php artisan apinexa:scan
- Generate documentation:
php artisan apinexa:docs
- Open
api-nexa/docs/index.htmlin your browser.
Middleware
Register the API key middleware on your API routes:
Route::middleware(['api', 'apinexa.key'])->group(base_path('routes/api.php'));
Protected schemas (auth => true) require a valid X-Api-Key header.
API Keys
Create signed keys programmatically:
use ZeeshanMushtaq\ApiNexa\Contracts\ApiKeyManagerContract; $key = app(ApiKeyManagerContract::class)->create( name: 'Partner Integration', mode: 'live', scopes: ['jobs:create'], permissions: ['POST:/jobs'], );
Keys are verified without a database lookup. Revocation is cache-backed.
Configuration
Publish and edit config/apinexa.php to customize schema paths, cache store, documentation output, and signing key (APINEXA_SIGNING_KEY).
Commands
| Command | Description |
|---|---|
APINEXA:install |
Publish config and scaffold directories |
APINEXA:scan |
Load and cache schemas into the registry |
APINEXA:docs |
Generate openapi.json and index.html |
License
MIT