Download the PHP package arnaud-ritti/mosparo-bundle without Composer
On this page you can find all versions of the php package arnaud-ritti/mosparo-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arnaud-ritti/mosparo-bundle
More information about arnaud-ritti/mosparo-bundle
Files in arnaud-ritti/mosparo-bundle
Package mosparo-bundle
Short Description A Symfony bundle for mosparo spam protection
License MIT
Homepage https://github.com/arnaud-ritti/mosparo-bundle
Informations about the package mosparo-bundle
Symfony Bundle
This bundle adds the required functionality to use mosparo in your Symfony form.
Description
With this PHP library you can connect to a mosparo installation and verify the submitted data.
Requirements
To use the plugin, you must meet the following requirements:
- A mosparo project
- Symfony 5.4 or greater
- PHP 8.0 or greater
Installation
Install this bundle by using composer:
Configuration
1. Register the bundle
Register bundle into config/bundles.php
:
2. Add configuration files
Setup bundle's config into config/packages/mosparo.yaml
:
Add your variables to your .env file:
Handle multiples configurations
Into your configuration file. ex: config/packages/mosparo.yaml
:
Inside your .env
files
Usage
How to integrate mosparo in Symfony form:
Additional options
Parameter | Type | Default value | Description |
---|---|---|---|
project |
String | default |
Defines the mosparo project to use for validation. See Handle multiples configurations |
allowBrowserValidation |
Boolean | false | Specifies whether browser validation should be active. |
cssResourceUrl |
String | empty | Defines the address at which the browser can load the CSS resources. You can use it if the correct resource address is cached. |
designMode |
Boolean | false | Used to display the mosparo box in the different states in the mosparo backend. The mosparo box is not functional if this option is set to true . |
inputFieldSelector |
String | [name]:not(.mosparo__ignored-field) |
Defines the selector with which the fields are searched. |
loadCssResource |
Boolean | true | Determines whether the script should also load the CSS resources during initialization. |
requestSubmitTokenOnInit |
Boolean | true |
Specifies whether a submit token should be automatically requested during initialization. If, for example, the form is reset directly after initialization (with reset() ), there is no need for a submit token during initialization, as a new code is requested with the reset. |
Ignored fields
Automatically ignored fields
mosparo automatically ignores the following fields:
- All fields which do not have a name (attribute
name
) - HTML field type
- password
- file
- hidden
- checkbox
- radio
- submit
- reset
- HTML button type
- submit
- button
- Fields containing
_mosparo_
in the name
Manually ignored fields
CSS class
If you give a form field the CSS class mosparo__ignored-field
, the field will not be processed by mosparo.
JavaScript initialisation
When initializing the JavaScript functionality, you can define the selector with which the fields are searched (see Parameters of the mosparo field).
Override allowed and verifiable field types
You can also register event listeners (or subscribers) to add or remove field types.
We use here a listener for example.
How to deal with functional and e2e testing:
Mosparo won't allow you to test your app efficiently unless you disable it for the environment you are testing against.
How to disable SSL verification:
In order to support invalid SSL certificats you will need to disable the SSL check.
For multiples configurations:
License
mosparo is open-sourced software licensed under the MIT License. Please see the LICENSE file for the full license.
Contributing
See CONTRIBUTING
All versions of mosparo-bundle with dependencies
ext-json Version *
symfony/config Version ^5.4 || ^6.0
symfony/form Version ^5.4 || ^6.0
symfony/yaml Version ^5.4 || ^6.0
symfony/dependency-injection Version ^5.4 || ^6.0
symfony/http-kernel Version ^5.4 || ^6.0
symfony/serializer Version ^5.4 || ^6.0
symfony/validator Version ^5.4 || ^6.0
symfony/twig-bundle Version ^5.4 || ^6.0
symfony/framework-bundle Version ^5.4 || ^6.0
symfony/event-dispatcher Version ^5.4 || ^6.0
mosparo/php-api-client Version ^1.0.2
ramsey/uuid Version ^4.0