PHPackages                             ashraam/laravel-capjs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ashraam/laravel-capjs

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

ashraam/laravel-capjs
=====================

A simple package to integrate Cap.js, an hCaptcha-like open source challenge, into your Laravel application.

v1.1.0(2mo ago)3581[1 PRs](https://github.com/Ashraam/laravel-capjs/pulls)MITPHPPHP ^8.1

Since Sep 16Pushed 2mo agoCompare

[ Source](https://github.com/Ashraam/laravel-capjs)[ Packagist](https://packagist.org/packages/ashraam/laravel-capjs)[ Docs](https://github.com/ashraam/laravel-capjs)[ RSS](/packages/ashraam-laravel-capjs/feed)WikiDiscussions develop Synced today

READMEChangelogDependencies (11)Versions (4)Used By (0)

Laravel Cap.js
==============

[](#laravel-capjs)

A simple package to integrate Cap.js, an hCaptcha-like open source challenge, into your Laravel application.

[![Latest Version on Packagist](https://camo.githubusercontent.com/85837a73e46c99f145b09bd3b20e544e39eaa201dcd76773e522b7900abe6b17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6173687261616d2f6361706a732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashraam/laravel-capjs)[![Total Downloads](https://camo.githubusercontent.com/7977d7cbf87af97bb9e8199e710224bf0a1eb0759a4033be4923a69cd709269b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6173687261616d2f6361706a732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ashraam/laravel-capjs)

This package provides a simple way to integrate [Cap.js](https://capjs.js.org/) into your Laravel application.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ashraam/laravel-capjs
```

Configuration
-------------

[](#configuration)

First, you need to publish the configuration file:

```
php artisan vendor:publish --provider="Ashraam\\Capjs\\CapjsServiceProvider" --tag="config"
```

This will create a `config/capjs.php` file in your application. You can then add your Cap.js credentials to your `.env` file:

```
CAPJS_HOST=
CAPJS_KEY=
CAPJS_SECRET=

```

Usage
-----

[](#usage)

### Blade Directive

[](#blade-directive)

To include the Cap.js script, you can use the `@capjsScript` directive in your Blade template:

```

    ...
    @capjsScript

    ...

```

### Facade

[](#facade)

You can also get the script tag from the `Capjs` facade:

```
{!! Capjs::script() !!}
```

### Blade Component

[](#blade-component)

To display the Cap.js widget, you can use the `` component:

```

    @csrf
    ...

    @error('cap-token') {{ $message }} @enderror
    ...
    Register

```

The component also accepts an optional `id` and `locale` attribute:

```

```

#### Events

[](#events)

The component dispatches custom events such as `solve`, `error`, `reset`, and `progress`. You can attach an event listener to the widget to capture these events.

For instance, to get the token when the captcha is solved, you would use the following JavaScript code:

```
const widget = document.querySelector("#my-capjs-widget");
widget.addEventListener("solve", function (e) {
  const token = e.detail.token; // Handle the token as needed
});
```

#### Styling

[](#styling)

You can customize the appearance of the widget by overriding the default CSS variables.

```
cap-widget {
  --cap-background: #fdfdfd;
  --cap-border-color: #dddddd8f;
  --cap-border-radius: 14px;
  --cap-widget-height: 30px;
  --cap-widget-width: 230px;
  --cap-widget-padding: 14px;
  --cap-gap: 15px;
  --cap-color: #212121;
  --cap-checkbox-size: 25px;
  --cap-checkbox-border: 1px solid #aaaaaad1;
  --cap-checkbox-border-radius: 6px;
  --cap-checkbox-background: #fafafa91;
  --cap-checkbox-margin: 2px;
  --cap-font: system, -apple-system, "BlinkMacSystemFont", ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", "Ubuntu", "arial", sans-serif;
  --cap-spinner-color: #000;
  --cap-spinner-background-color: #eee;
  --cap-spinner-thickness: 5px;
  --cap-checkmark: url("data:image/svg+xml,...");
  --cap-error-cross: url("data:image/svg+xml,...");
  --cap-credits-font-size: 12px;
  --cap-opacity-hover: 0.8;
}
```

### Validation Rule

[](#validation-rule)

To validate the Cap.js token, you can use the `capjs` validation rule:

```
use Illuminate\Http\Request;

public function register(Request $request)
{
    $request->validate([
        ...
        'cap-token' => ['required', 'capjs'],
        ...
    ]);

    ...
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Romain BERTOLUCCI](https://github.com/ashraam)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance84

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~209 days

Total

2

Last Release

82d ago

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v1.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4ae559aed0680b10f170eb8ce9a186ef2333ff59c0c80970d3e0fec23b02561?d=identicon)[Ashraam](/maintainers/Ashraam)

---

Top Contributors

[![Ashraam](https://avatars.githubusercontent.com/u/4686383?v=4)](https://github.com/Ashraam "Ashraam (11 commits)")

---

Tags

laravelcaptchahcaptchaashraamcap.js

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ashraam-laravel-capjs/health.svg)

```
[![Health](https://phpackages.com/badges/ashraam-laravel-capjs/health.svg)](https://phpackages.com/packages/ashraam-laravel-capjs)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[api-platform/laravel

API Platform support for Laravel

58171.8k14](/packages/api-platform-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816334.1k3](/packages/defstudio-telegraph)[illuminate/routing

The Illuminate Routing package.

1419.2M3.0k](/packages/illuminate-routing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
