定制 specdocular/php-openapi 二次开发

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

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

specdocular/php-openapi

最新稳定版本:v0.1.0

Composer 安装命令:

composer require specdocular/php-openapi

包简介

Object-oriented OpenAPI implementation for PHP

README 文档

README

Latest Version on Packagist PHP Version Tests codecov Code Style

An object-oriented OpenAPI 3.1.x builder for PHP. Build complete API specifications with a fluent, chainable API that hides the complexity of the OpenAPI specification.

Installation

composer require specdocular/php-openapi

Usage

use Specdocular\OpenAPI\Schema\Objects\OpenAPI\OpenAPI;
use Specdocular\OpenAPI\Schema\Objects\Info\Info;
use Specdocular\OpenAPI\Schema\Objects\PathItem\PathItem;
use Specdocular\OpenAPI\Schema\Objects\Operation\Operation;
use Specdocular\OpenAPI\Schema\Objects\Schema\Schema;
use Specdocular\JsonSchema\Draft202012\Keywords\Properties\Property;

$openApi = OpenAPI::v311(
    Info::create('Pet Store', '1.0.0')
        ->description('A sample Pet Store API')
);

// Define schemas
$petSchema = Schema::object()
    ->properties(
        Property::create('id', Schema::string()->format('uuid')),
        Property::create('name', Schema::string()),
    )
    ->required('id', 'name');

// Export as JSON
$json = json_encode($openApi, JSON_PRETTY_PRINT);

Features

  • Fluent, chainable API for all OpenAPI 3.1.x objects
  • Full support for Paths, Operations, Schemas, Responses, Request Bodies, Parameters, Security Schemes, and more
  • Automatic component reference collection and management
  • Built on specdocular/php-json-schema for schema definitions
  • Framework-agnostic — no dependencies on Laravel or any framework

Related Packages

Package Description
specdocular/php-json-schema JSON Schema Draft 2020-12 builder (foundation)
specdocular/laravel-openapi Laravel integration for OpenAPI generation (uses this package)
specdocular/laravel-rules-to-schema Convert Laravel validation rules to JSON Schema

License

MIT. See LICENSE for details.

统计信息

  • 总下载量: 471
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固