Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ This family resolves through git VCS repositories rather than Packagist — deli
version badge above points at the git tag for that reason. The repository entries are already in
`composer.json`. See [Installation](docs/installation.md).

## Quick start
## Quick start guide and usage

### Getting started

Nothing to configure: the default provider is self-hosted arithmetic, so a fresh install works with no account, no keys and no JavaScript. Two optional commands:

```bash
php artisan laranail::captcha.install # publish config/laranail/captcha.php, only to change something
php artisan laranail::captcha.doctor # report the active provider and where each credential resolves from
```

To switch provider, set `CAPTCHA_PROVIDER`, `CAPTCHA_SITE_KEY` and `CAPTCHA_SECRET_KEY` in `.env`.

### Usage

```blade
<form method="post" action="/register">
Expand All @@ -45,6 +58,16 @@ $request->validate([
]);
```

Bind a token to one form, so a token minted for another form cannot be replayed on login:

```php
use Simtabi\Laranail\Captcha\Rules\Captcha;

$request->validate([
'captcha' => [Captcha::for('login')],
]);
```

Switching to Turnstile later is one config line. The markup and the rule do not change.

## The two axes
Expand Down
Loading