Download the PHP package xaniashield/laravel without Composer
On this page you can find all versions of the php package xaniashield/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xaniashield/laravel
More information about xaniashield/laravel
Files in xaniashield/laravel
Package laravel
Short Description Privacy-first, EU-hosted spam protection for Laravel forms. Official Laravel client for the Xania Shield API.
License MIT
Homepage https://xaniashield.com
Informations about the package laravel
Xania Shield for Laravel
Privacy-first, EU-hosted spam protection for Laravel forms. This is the official Laravel client for the Xania Shield API — block bots and spam across your forms without CAPTCHAs, without Google, and without sending visitor data to third-party AI services.
- No CAPTCHAs — works invisibly in the background
- EU-hosted & GDPR-friendly — local statistical analysis, no Big Tech
- Fail-open by design — if the API is unreachable, your forms keep working
- Drop-in — one line per form, with optional honeypot and timing signals
Requirements
- PHP 8.1+
- Laravel 10, 11, 12, or 13
- A Xania Shield API key (create one free at app.xaniashield.com)
Installation
The service provider and Shield facade are auto-discovered — no manual registration needed.
Publish the config file (optional):
Add your credentials to .env:
Usage
Basic — analyze a submission
Inject the client (or use the Shield facade) in any controller:
With the facade
The verdict object
Honeypot
A honeypot is a hidden field that bots fill and humans never touch. Add one to your form:
The client reads the configured honeypot field automatically (default website_url). To use a different field name, pass it explicitly:
Timing signal (optional)
The timing signal measures how long a form took to fill — bots submit near-instantly. It requires SHIELD_TIMING_SECRET to be set.
Render a signed timestamp field in your form:
The client verifies and includes the elapsed time automatically on the next checkRequest().
Fail-open vs fail-closed
By default (SHIELD_FAIL_OPEN=true), if the API is unreachable, times out, or errors, submissions are allowed — protection never breaks your forms. Set SHIELD_FAIL_OPEN=false to block on uncertainty instead (stricter, but a Shield outage would block submissions).
Health check
Configuration reference
All values are read from config/shield.php (env-driven):
| Key | Env | Default | Purpose |
|---|---|---|---|
api_key |
SHIELD_API_KEY |
'' |
Your site API key |
base_url |
SHIELD_BASE_URL |
https://xaniashield.com/v1 |
API base URL |
timeout |
SHIELD_TIMEOUT |
5 |
Request timeout (seconds) |
fail_open |
SHIELD_FAIL_OPEN |
true |
Allow on API failure |
timing_secret |
SHIELD_TIMING_SECRET |
'' |
HMAC secret for timing |
challenge_threshold |
SHIELD_CHALLENGE_THRESHOLD |
40 |
Score for challenge |
block_threshold |
SHIELD_BLOCK_THRESHOLD |
70 |
Score for block |
honeypot_field |
SHIELD_HONEYPOT_FIELD |
website_url |
Honeypot field name |
timing_field |
SHIELD_TIMING_FIELD |
xsh_tf |
Timing field name |
Integration recipes
Forms differ across projects — field names, honeypots, Livewire vs controllers. Pick the entry point that fits. All of them ultimately call the same engine; choose by how much control you want.
1. Middleware (simplest — protect a whole route)
For standard forms with email / message / name / subject fields:
On a block verdict it aborts with HTTP 422 before reaching your controller. No controller changes needed. For non-standard field names, use one of the options below instead.
2. Validation rule (idiomatic — fits existing validation)
Attach the rule to one field only (usually email) — it analyses the whole request, not just that field. A block fails validation with a generic message you can customise: new ShieldRule('contact', 'Your message looks like spam.').
3. Controller call (most control — custom field mapping)
When your fields are non-standard, map them explicitly:
4. Livewire component
Livewire has no per-submit HTTP request for the form fields, so pass values from the component state and add visitor_ip explicitly.
5. Form Request class
6. API endpoint (JSON)
Honeypot & timing in Blade
Add a honeypot (and optionally a timing field) to any form with directives:
@shieldHoneypot renders a hidden field named after config('shield.honeypot_field'). The client reads it back automatically.
License
MIT — see LICENSE.
All versions of laravel with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0