Download the PHP package drewlabs/laravexists without Composer
On this page you can find all versions of the php package drewlabs/laravexists. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drewlabs/laravexists
More information about drewlabs/laravexists
Files in drewlabs/laravexists
Package laravexists
Short Description Library provides existance rule implementation for laravel/lumen based projects
License MIT
Informations about the package laravexists
Laravexists
Laravexists
package provides developper with utility and classes that calls exists
rule on data source. It internally use the laravel Rule::exists()
or an existance verifier class that must provides implementation that check data existance on a given data source.
Installation
To install the library in a PHP project, use the composer package manager:
composer require drewlabs/laravexists
The command above install the library and all it dependencies.
Usage
- Using the default laravel exists rule
The library can be used as a drop-in replacement for Laravel default Rule::exists()
validation rule as it support it internally.
- Using an HTTP existance verifier
The library comes with an HTTP existance verifier with can be used as a factory instance for verifying existance of a data using REST interface. It's kind of the main purpose of this library as it allow to check if a given data exist on a given server remoetly. The library relies on query parameter do send query that filters the result from the the HTTP server (if supported by the server).
Note By default the HTTPExistanceClient
class uses an internal callback that filter and validate the entry data
of the server json response. To override the default implementation:
- Custom verifier
The library comes with an interface that can be implemented to provide a custom existance, verifier:
- Customize the validation error message (^0.1.2)
Case required to customize the message output to user when validation fails, use the withMessage()
method or pass a third or fourth argument to the class constructor:
Note The library is still under development as the API might change.