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. ashraam/laravel-capjs

ActiveLibrary

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

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

v1.0.0(7mo ago)3421[1 PRs](https://github.com/Ashraam/laravel-capjs/pulls)MITPHPPHP ^7.4|^8.0

Since Sep 16Pushed 7mo 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 1mo ago

READMEChangelogDependencies (6)Versions (3)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://cap.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

32

—

LowBetter than 72% of packages

Maintenance62

Regular maintenance activity

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

238d ago

### 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 (9 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

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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