Download the PHP package kentaroutakeda/laravel-openapi-validator without Composer

On this page you can find all versions of the php package kentaroutakeda/laravel-openapi-validator. 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-openapi-validator

Laravel OpenAPI Validator

Request and response validators based on the OpenAPI Specification.

Summary

Requirements

Installation

You can install the package via composer:

Usage

  1. Configure OpenAPI Specification

    If you're using Laravel OpenAPI, you don't need to do anything.

    For L5 Swagger, the following settings are required:

    How to load your own schema without using these packages will be explained later.

  2. Register Middleware

    Routes with this setting will be validated for all requests including Feature Tests, and depending on the settings, responses as well.

    NOTE:
    This repository's ./e2e directory contains working examples for e2e testing. You can see middleware configuration examples in Routing, and actual validations and failures in Tests.

  3. (Optional) Customize Middleware

    If necessary, you can change Middleware behavior for each route.

    NOTE:
    Response validation for large amounts of data can take a long time. It would be a good idea to switch on/off validation depending on the route and APP_* environment variables.

  4. Deployment

    When deploying your application to production, you should make sure that you run the openapi-validator:cache Artisan command during your deployment process:

    This command caches the OpenAPI Spec defined in your application. If you change the definition for development, you need to clear it as follows:

(Optional) Swagger UI support

You can view the Swagger UI just by installing the package. No additional configuration is required.

  1. Install package.

  2. Display APP_URL/openapi-validator/documents in browser.

NOTE:
By default, the Swagger UI can only be displayed when APP_DEBUG is enabled.

(Optional) Customization

Publish Configuration

You can publish the config file to change behavior.

Alternatively, most settings can be changed using environment variables. Check the comments in config/openapi-validator.php for details.

Your own schema providers

  1. If you want to use your own schema providers, first publish the config.

  2. Next, implement a class to retrieve the schema.

  3. Finally, set it in your config.

Error responses and customization

By default, it is formatted according to RFC 7807 - Problem Details for HTTP APIs.

Validation errors, stack traces and original response can also be included depending on your settings. For example, it might look like this:

Here's how to change to a different format:

  1. First, implement a class to generate a response. For example:

  2. Next, register the class to the service container.

Events

If a validation error occurs, an event will be fired depending on the type of error.

Contributing and Development

Feel free to open an Issue or add a Pull request.

When adding a pull request, please refer to the following setup steps.

License

Laravel OpenAPI Validator is open-sourced software licensed under the MIT license.


All versions of laravel-openapi-validator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
laravel/framework Version ^9.0|^10.0|^11.0|^12.0
league/openapi-psr7-validator Version ^0.22.0
nyholm/psr7 Version ^1.8
symfony/psr-http-message-bridge Version ^6.0|^7.0
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 kentaroutakeda/laravel-openapi-validator contains the following files

Loading the files please wait ....