Search by

exeque / laravel-mosparo

ExeQue

mosparo spam protection for Laravel and Livewire: a configured client, a validation rule, a Blade box and a Livewire form that asks for fresh tokens after every check.

Package info

github.com/ExeQue/laravel-mosparo

pkg:composer/exeque/laravel-mosparo

Statistics

Installs: 13

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.3 2026-10-24 19:24 UTC

This package is auto-updated.

Last update: 2026-10-24 19:25:32 UTC


README

laravel-mosparo - spam protection for Laravel and Livewire, without the captcha

Latest version Total downloads Tests Documentation PHP version Laravel version License

Laravel × mosparo

Documentation: exeque.github.io/laravel-mosparo

mosparo spam protection for Laravel and Livewire. Put the box in a form with one directive, and check the submission with a validation rule, a Livewire trait or a facade, naming the fields mosparo must have checked.

Install

composer require exeque/laravel-mosparo
MOSPARO_HOST=https://mosparo.example.com
MOSPARO_UUID=your-project-uuid
MOSPARO_PUBLIC_KEY=your-public-key
MOSPARO_PRIVATE_KEY=your-private-key

Use

<head>
    @mosparoScript
</head>

<form method="post" action="/newsletter">
    @csrf
    <input name="email" type="email">

    @mosparo
    @mosparoError <p class="error">{{ $message }}</p> @enderror

    <button type="submit">Subscribe</button>
</form>

A plain form post is checked by a validation rule:

use ExeQue\Mosparo\Rules\ValidMosparo;

'_mosparo_submitToken' => [new ValidMosparo(['email'])],

A Livewire component uses the trait:

use ExeQue\Mosparo\Livewire\Concerns\InteractsWithMosparo;
use Livewire\Component;

class SignIn extends Component
{
    use InteractsWithMosparo;

    public SignInForm $form;

    public function signIn(): void
    {
        if (! $this->mosparo->verify($this->form, ['email'])) {
            return;
        }

        // ...
    }
}

Anything else asks the facade:

use ExeQue\Mosparo\Facades\Mosparo;

Mosparo::passes($formData, $submitToken, $validationToken, ['email', 'message']);

Features

Read on in the documentation.

License

The code is MIT; see LICENSE.md.

The cover shows Mo, the sparrow, by mosparo, licensed under CC BY-SA 4.0. The cover and the other artwork in art/ are CC BY-SA 4.0 as well; see art/LICENSE.md. mosparo and Laravel do not endorse this package.