定制 zeeshanmushtq/apinexa 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. 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',
    ],
];
  1. Compile schemas:
php artisan apinexa:scan
  1. Generate documentation:
php artisan apinexa:docs
  1. Open api-nexa/docs/index.html in 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固