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.
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.
Informations about the package laravel-remote-rule
# Laravel Remote Rule
[](https://packagist.org/packages/maize-tech/laravel-remote-rule)
[](https://github.com/maize-tech/laravel-remote-rule/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/maize-tech/laravel-remote-rule/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[](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
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 maize-tech/laravel-remote-rule contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.