Download the PHP package beblife/schema-validation-laravel without Composer

On this page you can find all versions of the php package beblife/schema-validation-laravel. 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 schema-validation-laravel

Schema Validation Laravel

Validate HTTP-requests using OpenAPI specification files or JSON-schema objects in Laravel.

Latest Version on Packagist PHP from Packagist CI

Installation

This package can be installed through Composer:

After that can publish the configuration file with this command:

Once published you will have a config/schema-validation.php file that looks like this:

You can define the spec path as a .env variable or hardcode the absolute path in the configuration file itself. The status code when a validation exception is thrown can also be customised here.

Usage

Validating Requests

This package provides a macro on the Illumnite\Http\Request::class that will validate the request's schema.

When the validateSchema() method is called the package will search for a matching path defined in the configured OpenAPI specification file and validate the request against the schema.

There are two possible exceptions that can occur when the validation takes place:

UnableToValidateSchema

When a path can't be found in the specification file this exception is thrown.

InvalidSchema

When the request does not match the schema defined in the specification file this exception is thrown. This exception extends the Laravel ValidationException which results in a 400 : Bad Request with the following format:

The package also provides a trait that can be added on a form request to validate the schema. Behind the scenes this trait hooks into the prepareForValidation() method to start validating the request's schema. Afterwards any additional validation defined in the rules() method will be handled by the Laravel framework.

The schema to use for validation will be resolved automatically from the configured OpenAPI specification file. This can be overwritten by defining a schema() on the FormRequest::class.

Defining Schema's

By default the package will use the schema's defined the configured specification when validating requests. There is also the option to pass a Beblife\SchemaValidation\Schema::class to the validateSchema() method using the provided facade:

From array

From File

From Class

License

The MIT License (MIT). Please see License File for more information.


All versions of schema-validation-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
guzzlehttp/psr7 Version ^1.8 || ^2.0
league/openapi-psr7-validator Version ^0.18
spatie/laravel-package-tools Version ^1.11
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 beblife/schema-validation-laravel contains the following files

Loading the files please wait ....