Download the PHP package maize-tech/laravel-remote-rule without Composer
On this page you can find all versions of the php package maize-tech/laravel-remote-rule. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download maize-tech/laravel-remote-rule
More information about maize-tech/laravel-remote-rule
Files in maize-tech/laravel-remote-rule
Download maize-tech/laravel-remote-rule
More information about maize-tech/laravel-remote-rule
Files in maize-tech/laravel-remote-rule
Vendor maize-tech
Package laravel-remote-rule
Short Description Laravel Remote Rule
License MIT
Homepage https://github.com/maize-tech/laravel-remote-rule
Package laravel-remote-rule
Short Description Laravel Remote Rule
License MIT
Homepage https://github.com/maize-tech/laravel-remote-rule
Please rate this library. Is it a good library?
Informations about the package laravel-remote-rule
# Laravel Remote Rule [![Latest Version on Packagist](https://img.shields.io/packagist/v/maize-tech/laravel-remote-rule.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-remote-rule) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-remote-rule/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/maize-tech/laravel-remote-rule/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/maize-tech/laravel-remote-rule/php-cs-fixer.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/maize-tech/laravel-remote-rule/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/maize-tech/laravel-remote-rule.svg?style=flat-square)](https://packagist.org/packages/maize-tech/laravel-remote-rule) Easily validate data attributes through a remote request. This package allows you to define a subset of custom rules to validate an incoming request data through an api call to a remote service. An example usage could be an application with an open registration form which should only allow a list of emails given by a remote service. You can find an example in the [Usage](#usage) section. ## Installation You can install the package via composer: You can publish and run the migrations with: You can publish the config file with: This is the content of the published config file: ## Usage ### Basic To use the package you can create a class which extends the `RemoteRule` abstract class. You can then create a new `RemoteRuleConfig` instance with the snake case name of the class you just created. The model will contain the url of the remote service used to send the request along with the request method (usually `POST` or `GET`) and, if needed, the custom headers, json body and timeout. We add this data to a database table as we consider it sensitive information, and we want to avoid hard-coding it to the codebase. All entries of the `remote_rule_configs` database table are indeed encrypted by default (can be disabled in the configs). You can create a remote rule config in your console with tinker: That's all! You can now just add your new custom rule to the validation array: Under the hood, the validation rule will send a request to the given url with the custom headers and body (where we append the attribute name and its value) and check whether the response is successful or not. ### Custom response status code You can change the expected response status code by overriding the `isSuccessful` method in your custom rule. ### Custom body attribute By default, all custom rules will append the attribute key-value pair to the request body, where the key is the name of the validated attribute, and the value is the input value of the form. You can change the body attribute sent to the remote service by overriding the `getBodyAttribute` method in your custom rule. ## Testing ## Changelog Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. ## Contributing Please see [CONTRIBUTING](https://github.com/maize-tech/.github/blob/main/CONTRIBUTING.md) for details. ## Security Vulnerabilities Please review [our security policy](https://github.com/maize-tech/.github/security/policy) on how to report security vulnerabilities. ## Credits - [Enrico De Lazzari](https://github.com/enricodelazzari) - [All Contributors](../../contributors) ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
All versions of laravel-remote-rule with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.0
illuminate/contracts Version ^9.0|^10.0|^11.0
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/http Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.1
illuminate/contracts Version ^9.0|^10.0|^11.0
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/http Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.14.1
The package maize-tech/laravel-remote-rule contains the following files
Loading the files please wait ....