Download the PHP package nicoandra/laravel-data-openapi-generator without Composer

On this page you can find all versions of the php package nicoandra/laravel-data-openapi-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-data-openapi-generator

Laravel Data OpenAPI Generator

Generate an OpenAPI specification directly from Laravel routes and Spatie Laravel Data classes.

The package treats your controllers and Data objects as the source of truth for request and response documentation, so your OpenAPI file stays close to the code that actually handles the API.

What it does

Installation

Install the package:

Publish the configuration:

Quick start

Use Data classes for your API inputs and outputs:

Annotate the controller method:

Register a route:

Generate the OpenAPI file:

By default the generated file is written to resources/api/openapi.json.

Generated routes

The package registers two routes:

Generate the file first with:

Supported attributes

#[Summary(...)]

Attach to a controller method to populate the OpenAPI operation summary.

#[Description(...)]

Attach to a controller method to describe the operation.

Attach to a Data class to describe the response associated with that class.

#[Example(...)]

Attach to a Data property or controller parameter to add example values to the generated schema or parameter.

#[IgnoreFromOpenApi]

Attach to a request Data property to exclude it from generated request bodies and derived GET query parameters.

Attach to a controller class or controller method to exclude matching routes from the generated OpenAPI document.

#[HttpResponseStatus(...)]

Attach to a response Data class to change the generated HTTP status code for that response.

#[CustomContentType(...)]

Attach to a Data class to emit request and response content under one or more custom content types.

#[ExposedAs(...)]

Use #[ExposedAs('string')] to document a transformed or cast value as an OpenAPI string. The constructor currently accepts only the literal value 'string'; the attribute changes the generated OpenAPI representation, not runtime casting or transformation behavior.

At class level, apply it to a Data class whose generated schema should be a string instead of an object reference:

At property level, apply it when a property typed as a transformed or cast Data value is exposed as a string in the schema:

Although the PHP attribute declaration permits class, property, and parameter targets, documented and generated support currently covers Data classes and Data properties only. Controller-parameter handling is not currently implemented. In the supported cases, it affects only the generated OpenAPI schema; it does not cast, transform, or otherwise change the runtime value.

#[Tags(...)]

Attach to a controller class or method to add OpenAPI tags to the generated operation.

Configuration

The published config file lives at config/openapi-generator.php.

Important options:

Example namespace aliasing:

This keeps schema names stable and avoids exposing internal namespace structure in your OpenAPI document.

Overlay spec files

Use overlay_files when you need manual additions that cannot be inferred from Laravel routes or Data classes, such as legacy endpoints, custom headers, or extra response variants.

Overlay specs are additive. They can add:

The generated spec is authoritative. If the generated file already has a path, method, response status code, schema, or security scheme with the same key, that generated value is kept and the overlay value is ignored for that key. For example, if both generated output and the overlay define GET /api/users response 200, the generated 200 response wins; the overlay can still add 404 or other missing status codes.

Security integration

Routes using configured auth middleware are emitted with OpenAPI security requirements.

If a route includes authorization middleware such as can:update-posts, the generated operation description also includes the required permissions and the package adds 403 Forbidden responses alongside 401 Unauthorized where appropriate.

Notes and limitations

Optional frontend integration

If you use vite-plugin-pwa, exclude /api/ routes from the service worker:

Minimal Vue page:

Development

You can also start the container with make dev and run commands from there.

For test coverage, run `make test-coverage``


All versions of laravel-data-openapi-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
nesbot/carbon Version ^2.0|^3.0
spatie/laravel-data Version ^4
phpdocumentor/reflection-docblock Version ^5.4
spatie/invade Version ^2
phpunit/phpunit Version ^11
laravel/framework Version ^8|^9|^10|^11|^12|^13
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nicoandra/laravel-data-openapi-generator contains the following files

Loading the files please wait ...