erasys/openapi-php
Erasys OpenAPI PHP lets you build OpenAPI 3 specifications directly in PHP using typed classes and fluent builders for schemas, paths, operations, parameters, and responses. Keep API documentation close to your code and easy to generate.
Architecture fit
erasys/openapi-php is a framework-agnostic PHP library for constructing OpenAPI 3.0 documents via a fluent object model and validating the resulting spec. It is a documentation/contract tool, not a runtime request validator.zircote/swagger-php annotations or a design-first YAML workflow.Integration feasibility
Schema objects) rather than by the library itself. Budget for a dedicated "spec builder" namespace and conventions.Technical risk
nullable removal, webhooks) is supported or on the roadmap; if your platform tooling is moving to 3.1, this is a gap.zircote/swagger-php is the de facto standard for PHP; choosing this package trades ecosystem familiarity and hiring pool for a cleaner programmatic API. That trade-off should be explicit.Key questions
swagger-php or design-first YAML) without rewriting consumers?Stack fit
App\OpenApi module containing the spec builder, schema definitions, and one Artisan command (openapi:generate) plus a validation command or test.league/openapi-psr7-validator or middleware-based validation) and a UI (Swagger UI/Redoc) if you need enforcement; this package alone does not validate live traffic.Migration path
swagger-php annotations: run both in parallel for one release cycle, compare generated documents, and switch consumers only after structural diff is clean. Do not attempt a big-bang cutover.Compatibility
composer.json and commit composer.lock; avoid caret ranges on a low-cadence package.Sequencing
swagger-php and design-first YAML on effort, maintainability, and ecosystem risk; record the decision and rationale.SpecBuilder interface, Artisan commands, and config so the package is isolated behind a seam.Maintenance
App\OpenApi module.Support
oneOf/allOf, nullable fields, file uploads) with in-house patterns rather than upstream guidance.Scaling
Failure modes
Ramp-up
How can I help you explore Laravel packages today?