Download the PHP package itxshakil/laravel-form-shield without Composer

On this page you can find all versions of the php package itxshakil/laravel-form-shield. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

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.
Please rate this library. Is it a good library?

Informations about the package laravel-form-shield

Laravel Form Shield

CI Latest version Total downloads

Spam scoring for Laravel forms, with no CAPTCHA. Suspected spam is quarantined instead of rejected, and the rules are tuned against your own labelled data.

A honeypot catches the dumbest bots. A CAPTCHA catches more, but it costs you real visitors, a third-party script, and a privacy question. Rejecting suspected spam outright quietly throws away the occasional real lead, and nobody ever finds out.

Form Shield is the layer after the honeypot:

Example report output:

It works with Blade forms, Livewire, Inertia/SPA forms, JSON APIs, and forms embedded in iframes on other sites.

Requirements

Install

The installer publishes the config, then asks where verdicts should be stored:

For scripts and CI: php artisan form-shield:install --table=inquiries --migrate or --log --migrate.

Quick start

1. Add the shield to your form, and the script once in your layout.

2. Store verdicts. If you picked an existing table, the installer already wrote the migration. You can also run it on its own:

Then add the trait to the model:

3. Inspect, store, and skip the side effects for spam.

Don't write Inquiry::create([...$data, ...$verdict->toAttributes()]). If your model lists its fields in $fillable, Laravel silently drops the spam columns and every row is saved as "not spam". createWithVerdict() fills $data normally and force-fills only the verdict columns. The two-step equivalent is Inquiry::make($data)->applyVerdict($verdict)->save().

No table of your own? Use the built-in log instead of the Inquiry model:

Prefer match? Every verdict has a status enum:

4. Label some submissions, then read the report.

Optional: reject obvious spam content

The scoring above never shows an error, because the point is that bots can't tell what was caught. A few patterns are different: a real person can fix them, so it's kinder to say so. NoSpamContent is a normal validation rule for those:

It fails with a visible error for more than 2 links, HTML or BBCode link markup, or a configured phrase like "quality backlinks". Leave it out if you'd rather everything went through quarantine. See signals.

Prefer middleware?

The middleware applies the rate caps up front (a 429) and, if you turn it on, rejects expired forms (a 422). It never rejects spam, because quarantine is your controller's job. The inspection itself runs on the first spamVerdict() call, so call it after validation. A visitor who fixes a typo and resubmits shouldn't be scored as a duplicate of their own first attempt. The same applies when you call FormShield::inspect() yourself.

Livewire

Inertia, SPAs, and cross-origin forms

Share FormShield::fields() as a prop, or enable the JSON endpoint (form-shield.route.enabled). Then arm the shield on the form's first interaction:

Testing your app

Documentation

How it compares

Honeypot packages CAPTCHA (reCAPTCHA, hCaptcha, Turnstile) Form Shield
Friction for real people none a challenge, sometimes none
Third-party script / privacy review no yes no
Catches bots that skip the honeypot rarely usually often, via scoring
What happens on a false positive lead lost lead lost quarantined, recoverable
Tells you which rules are wrong no no yes, precision per signal

Form Shield isn't a CAPTCHA replacement for high-value targets like login or signup under attack. It's for contact, quote, booking, newsletter and lead forms, where the cost of a lost real message is high and the attacker is a generic bot.

Origin

Form Shield is extracted from the contact and booking forms of a production hosting platform, where it replaced a CAPTCHA proposal. The design decisions are written up in docs/how-it-works.md.

Changelog

See CHANGELOG.md.

Contributing

See Code of Conduct. New signals are especially welcome; please include precision numbers from real traffic if you have them.

Security

Please report vulnerabilities privately. See SECURITY.md.

Credits

License

MIT. See LICENSE.md.


All versions of laravel-form-shield with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.0|^13.0
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 itxshakil/laravel-form-shield contains the following files

Loading the files please wait ...