Download the PHP package bakome/laravel-validation-attributes without Composer

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

Use PHP 8 attributes to implement request data validation

Latest Version on Packagist Tests Type Coverage

This package provides annotations to easily add validation rules on action methods in a controller. Here's a quick example:

Motivation

This project exists to provide simple and cleaner way to validate request data on Laravel controllers. Using validation rules in action methods often complicate readability of the controller and adding validation in separate requests classes imply switching trough that classes multiple time to view and change the rules (Losing focus). With this simple attributes we can make validation more accessible and maintainable in the controllers without messing the controller code.

Installation

You can install the package via composer:

You can publish the config file with:

Usage

The package provides several annotations that should be put on controller action methods. These annotations are used to validate request data.

Adding a validation rule with string as a parameter

This attribute will check if title parameter is present in current request and throw validation error if not present.

Adding a validation rule with an array as a parameter

This attribute will check if title parameter is present in current request and throw validation error if not present.

Adding a multiple validation rules

This attribute will check if title and description parameters are present in current request and throw validation error if not present.

Adding a redirect for failed validation

This attribute will check if title and description parameters are present in current request, compile validation error messages and redirect the page to provided route.

Adding a redirect with input for failed validation

This attribute will check if title and description parameters are present in current request, compile validation error messages and redirect the page to provided route including old input parameters.

Ajax's requests awareness and proper json responses returned for failed validation

Config

Plugin enabled/disabled

This plugin can be enabled or disabled with altering this property in configuration file. Default value is true (Enabled).

Plugin enabled/disabled

This property enables developers to provide a different handler for Validation via Middleware. Please be careful with this option and don't change it if you don't need custom behaviour.

Validation middleware

This property enables developers to provide a different handler for Validation via Middleware. Please be careful with this option and don't change it if you don't need custom behaviour.

Detect api routes

This property provide value for detecting api routes. Using expects json sometimes is not enough and when that lacks this option/feature do the job.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

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

Roadmap


All versions of laravel-validation-attributes with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8.12
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 bakome/laravel-validation-attributes contains the following files

Loading the files please wait ....