{"id":37012518,"url":"https://github.com/ar-koder/mosparo-bundle","last_synced_at":"2026-01-14T01:11:27.493Z","repository":{"id":157711757,"uuid":"633296159","full_name":"ar-koder/mosparo-bundle","owner":"ar-koder","description":"A Symfony bundle for mosparo spam protection","archived":false,"fork":false,"pushed_at":"2025-08-11T22:21:50.000Z","size":258,"stargazers_count":5,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-08T21:21:55.009Z","etag":null,"topics":["mosparo","php","spam-detection","symfony"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ar-koder.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"arnaudritti"}},"created_at":"2023-04-27T07:41:11.000Z","updated_at":"2025-03-04T20:02:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e5705b0-10e7-492c-bead-834b2958acf0","html_url":"https://github.com/ar-koder/mosparo-bundle","commit_stats":null,"previous_names":["ar-koder/mosparo-bundle"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ar-koder/mosparo-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-koder%2Fmosparo-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-koder%2Fmosparo-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-koder%2Fmosparo-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-koder%2Fmosparo-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ar-koder","download_url":"https://codeload.github.com/ar-koder/mosparo-bundle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-koder%2Fmosparo-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mosparo","php","spam-detection","symfony"],"created_at":"2026-01-14T01:11:26.676Z","updated_at":"2026-01-14T01:11:27.491Z","avatar_url":"https://github.com/ar-koder.png","language":"PHP","readme":" \n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/mosparo/mosparo/blob/master/assets/images/mosparo-logo.svg?raw=true\" alt=\"mosparo logo contains a bird with the name Mo and the mosparo text\"/\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n    Symfony Bundle\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    This bundle adds the required functionality to use mosparo in your Symfony form.\n\u003c/p\u003e\n\n![GitHub](https://img.shields.io/github/license/arnaud-ritti/mosparo-bundle)\n[![GitHub checks](https://github.com/arnaud-ritti/mosparo-bundle/actions/workflows/release.yaml/badge.svg)](https://github.com/arnaud-ritti/mosparo-bundle/actions/workflows/release.yaml)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/arnaud-ritti/mosparo-bundle)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/0f5b1debea2c4a169e44ee5e09397927)](https://app.codacy.com/gh/arnaud-ritti/mosparo-bundle/dashboard?utm_source=gh\\\u0026utm_medium=referral\\\u0026utm_content=\\\u0026utm_campaign=Badge_grade)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/0f5b1debea2c4a169e44ee5e09397927)](https://app.codacy.com/gh/arnaud-ritti/mosparo-bundle/dashboard?utm_source=gh\\\u0026utm_medium=referral\\\u0026utm_content=\\\u0026utm_campaign=Badge_coverage)\n\n***\n\n## Description\n\nWith this PHP library you can connect to a mosparo installation and verify the submitted data.\n\n## Requirements\n\nTo use the plugin, you must meet the following requirements:\n\n* A mosparo project\n* Symfony 5.4 or greater\n* PHP 8.0 or greater\n\n## Installation\n\nInstall this bundle by using composer:\n\n```text\ncomposer require arnaud-ritti/mosparo-bundle\n```\n\n## Configuration\n\n### 1. Register the bundle\n\nRegister bundle into `config/bundles.php`:\n\n```php\nreturn [\n    //...\n    Mosparo\\MosparoBundle\\MosparoBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n### 2. Add configuration files\n\nSetup bundle's config into `config/packages/mosparo.yaml`:\n\n```yaml\nmosparo:\n  instance_url: '%env(MOSPARO_INSTANCE_URL)%'\n  uuid: '%env(MOSPARO_UUID)%'\n  public_key: '%env(MOSPARO_PUBLIC_KEY)%'\n  private_key: '%env(MOSPARO_PRIVATE_KEY)%'\n```\n\nAdd your variables to your .env file:\n\n```text\n###\u003e mosparo/mosparo-bundle ###\nMOSPARO_INSTANCE_URL=https://example.com\nMOSPARO_UUID=\u003cyour-project-uuid\u003e\nMOSPARO_PUBLIC_KEY=\u003cyour-project-public-key\u003e\nMOSPARO_PRIVATE_KEY=\u003cyour-project-private-key\u003e\n###\u003c mosparo/mosparo-bundle ###\n```\n\n### Handle multiples configurations\n\nInto your configuration file. ex: `config/packages/mosparo.yaml`:\n\n```yaml\nmosparo:\n  default_project: '%env(MOSPARO_DEFAULT)%'\n  projects:\n    forms:\n      instance_url: '%env(MOSPARO_FORMS_INSTANCE_URL)%'\n      uuid: '%env(MOSPARO_FORMS_UUID)%'\n      public_key: '%env(MOSPARO_FORMS_PUBLIC_KEY)%'\n      private_key: '%env(MOSPARO_FORMS_PRIVATE_KEY)%'\n    login:\n      instance_url: '%env(MOSPARO_LOGIN_INSTANCE_URL)%'\n      uuid: '%env(MOSPARO_LOGIN_UUID)%'\n      public_key: '%env(MOSPARO_LOGIN_PUBLIC_KEY)%'\n      private_key: '%env(MOSPARO_LOGIN_PRIVATE_KEY)%'\n```\n\nInside your `.env` files\n\n```text\n###\u003e mosparo/mosparo-bundle ###\nMOSPARO_DEFAULT=\u003cyour-default-config\u003e\n\nMOSPARO_FORMS_INSTANCE_URL=\u003cyour-forms-project-instance\u003e\nMOSPARO_FORMS_UUID=\u003cyour-forms-project-uuid\u003e\nMOSPARO_FORMS_PUBLIC_KEY=\u003cyour-forms-project-public-key\u003e\nMOSPARO_FORMS_PRIVATE_KEY=\u003cyour-forms-project-private-key\u003e\n\nMOSPARO_LOGIN_INSTANCE_URL=\u003cyour-login-project-instance\u003e\nMOSPARO_LOGIN_UUID=\u003cyour-login-project-uuid\u003e\nMOSPARO_LOGIN_PUBLIC_KEY=\u003cyour-login-project-public-key\u003e\nMOSPARO_LOGIN_PRIVATE_KEY=\u003cyour-login-project-private-key\u003e\n###\u003c mosparo/mosparo-bundle ###\n```\n\n## Usage\n\n### How to integrate mosparo in Symfony form:\n\n```php\n\u003c?php\n\nuse Mosparo\\MosparoBundle\\Form\\Type\\MosparoType;\n\nclass TaskType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options)\n    {\n        $builder-\u003eadd('mosparo', MosparoType::class, [\n            'project' =\u003e 'default',\n            'allowBrowserValidation' =\u003e false,\n            'cssResourceUrl' =\u003e '',\n            'designMode' =\u003e false,\n            'inputFieldSelector' =\u003e '[name]:not(.mosparo__ignored-field)',\n            'loadCssResource' =\u003e true,\n            'requestSubmitTokenOnInit' =\u003e true,\n        ]);\n    }\n}\n```\n\n### Additional options\n\n| Parameter                  | Type    | Default value                         | Description                                                                                                                                                                                                                                                                     |\n|----------------------------|---------|---------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `project`                  | String  | `default`                             | Defines the mosparo project to use for validation. See [Handle multiples configurations](#handle-multiples-configurations)                                                                                                                                                                                                                         |\n| `allowBrowserValidation`   | Boolean | false                                 | Specifies whether browser validation should be active.                                                                                                                                                                                                                          |\n| `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.                                                                                                                                                  |\n| `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`.                                                                                                                              |\n| `inputFieldSelector`       | String  | `[name]:not(.mosparo__ignored-field)` | Defines the selector with which the fields are searched.                                                                                                                                                                                                                        |\n| `loadCssResource`          | Boolean | true                                  | Determines whether the script should also load the CSS resources during initialization.                                                                                                                                                                                         |\n| `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. |\n\n## Ignored fields\n\n### Automatically ignored fields\n\nmosparo automatically ignores the following fields:\n\n* All fields which **do not** have a name (attribute `name`)\n* HTML field type\n  * *password*\n  * *file*\n  * *hidden*\n  * *checkbox*\n  * *radio*\n  * *submit*\n  * *reset*\n* HTML button type\n  * *submit*\n  * *button*\n* Fields containing `_mosparo_` in the name\n\n### Manually ignored fields\n\n#### CSS class\n\nIf you give a form field the CSS class `mosparo__ignored-field`, the field will not be processed by mosparo.\n\n#### JavaScript initialisation\n\nWhen initializing the JavaScript functionality, you can define the selector with which the fields are searched (see [Parameters of the mosparo field](#additional-options)).\n\n### Override allowed and verifiable field types\n\nYou can also register event listeners (or subscribers) to add or remove field types.\n\nWe use here a listener for example.\n\n```php\n// src/EventListener/FilterFieldTypesListener.php\nnamespace App\\EventListener;\n\nuse Mosparo\\MosparoBundle\\Event\\FilterFieldTypesEvent;\nuse Symfony\\Component\\EventDispatcher\\Attribute\\AsEventListener;\n\n#[AsEventListener]\nclass FilterFieldTypesListener\n{\n    public function __invoke(FilterFieldTypesEvent $event): FilterFieldTypesEvent\n    {\n        // Remove PasswordType from the ignored list\n        $event-\u003esetIgnoredFieldTypes(array_diff(\n          $event-\u003egetIgnoredFieldTypes(), \n          [\n            PasswordType::class\n          ]\n        ));\n        \n        // Add PasswordType to the verifiable list\n        $event-\u003esetVerifiableFieldTypes(array_merge(\n          $event-\u003egetVerifiableFieldTypes(), \n          [\n            PasswordType::class\n          ]\n        ));\n\n        return $event;\n    }\n}\n```\n\n### How to deal with functional and e2e testing:\n\nMosparo won't allow you to test your app efficiently unless you disable it for the environment you are testing against.\n\n```yaml\n# config/packages/mosparo.yaml\nmosparo:\n  enabled: '%env(bool:MOSPARO_ENABLED)%'\n```\n\n```bash\n#.env.test or an environment variable\nMOSPARO_ENABLED=0\n```\n\n### How to disable SSL verification:\n\nIn order to support invalid SSL certificats you will need to disable the SSL check.\n\n```yaml\n# config/packages/mosparo.yaml\nmosparo:\n  ...\n  verify_ssl: '%env(bool:MOSPARO_VERIFY_SSL)%'\n```\n\n```bash\n#.env or an environment variable\nMOSPARO_VERIFY_SSL=0\n```\n\n#### For multiples configurations:\n\n```yaml\n# config/packages/mosparo.yaml\nmosparo:\n  projects:\n    forms:\n      ...\n      verify_ssl: '%env(bool:MOSPARO_FORMS_VERIFY_SSL)%'\n    login:\n      ...\n      verify_ssl: '%env(bool:MOSPARO_LOGIN_VERIFY_SSL)%'\n```\n\n```bash\n#.env or an environment variable\nMOSPARO_FORMS_VERIFY_SSL=0\nMOSPARO_LOGIN_VERIFY_SSL=0\n```\n\n## License\n\nmosparo is open-sourced software licensed under the [MIT License](https://opensource.org/licenses/MIT).\nPlease see the [LICENSE](LICENSE) file for the full license.\n\n## Contributing\n\nSee [CONTRIBUTING](.github/CONTRIBUTING)\n","funding_links":["https://ko-fi.com/arnaudritti"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Far-koder%2Fmosparo-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Far-koder%2Fmosparo-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Far-koder%2Fmosparo-bundle/lists"}