zeeshanmushtq/apinexa
Composer 安装命令:
composer require zeeshanmushtq/apinexa
包简介
File-first API schema engine for Laravel with runtime registry, OpenAPI generation and signed API keys.
README 文档
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
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-23