PHPackages                             xlock/laravel - 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. [Security](/categories/security)
4. /
5. xlock/laravel

ActiveLibrary[Security](/categories/security)

xlock/laravel
=============

x-lock bot protection middleware for Laravel

0.1.0(3mo ago)00MITPHPPHP &gt;=8.1

Since Apr 5Pushed 3mo agoCompare

[ Source](https://github.com/xlock-dev/xlock-laravel)[ Packagist](https://packagist.org/packages/xlock/laravel)[ Docs](https://x-lock.dev)[ RSS](/packages/xlock-laravel/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

xlock/laravel
=============

[](#xlocklaravel)

Laravel middleware for [x-lock](https://x-lock.cloud) bot protection.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel 10, 11, or 12

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

[](#installation)

```
composer require xlock/laravel
```

The service provider is auto-discovered. To publish the config file:

```
php artisan vendor:publish --tag=xlock-config
```

Add your site key to `.env`:

```
XLOCK_SITE_KEY=sk_your_site_key

```

Usage
-----

[](#usage)

Apply the `xlock` middleware to any routes you want to protect:

```
Route::middleware('xlock')->group(function () {
    Route::post('/login', [AuthController::class, 'login']);
    Route::post('/register', [AuthController::class, 'register']);
});
```

Or apply it to a single route:

```
Route::post('/checkout', [CheckoutController::class, 'store'])->middleware('xlock');
```

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

[](#configuration)

KeyEnv VariableDefaultDescription`site_key``XLOCK_SITE_KEY``null`Your x-lock site key`api_url``XLOCK_API_URL``https://api.x-lock.dev`Enforcement API endpoint`fail_open``XLOCK_FAIL_OPEN``true`Allow requests when API is unreachableHow it works
------------

[](#how-it-works)

The middleware intercepts POST requests and checks for an `x-lock` header token. It sends the token to the x-lock enforcement API for verification. If the token is missing or rejected, the request is blocked with a 403 response.

When `fail_open` is `true` (the default), requests are allowed through if the x-lock API is unreachable or returns an unexpected error.

License
-------

[](#license)

MIT

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

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

91d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/262658454?v=4)[linus](/maintainers/pentium-solver)[@pentium-solver](https://github.com/pentium-solver)

---

Tags

middlewarelaravelsecuritybot-protectionx-lock

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

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

Add CSP headers to the responses of a Laravel app

86611.1M25](/packages/spatie-laravel-csp)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58171.8k14](/packages/api-platform-laravel)

PHPackages © 2026

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