PHPackages                             wilfreedi/laravel-site-protection - 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. wilfreedi/laravel-site-protection

ActiveLibrary[Security](/categories/security)

wilfreedi/laravel-site-protection
=================================

Site protection

0.1.9(1y ago)021MITPHPPHP ^8.1

Since Jan 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/wilfreedi/laravel-site-protection)[ Packagist](https://packagist.org/packages/wilfreedi/laravel-site-protection)[ RSS](/packages/wilfreedi-laravel-site-protection/feed)WikiDiscussions master Synced 1mo ago

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

 [ Laravel Site Protection ](https://github.com/wilfreedi/laravel-site-protection)
==================================================================================

[](#------laravel-site-protection--)

 [![Packagist License](https://camo.githubusercontent.com/042e7f14b9ad19c0919e14d8804e2ef456213cf7e81408d696bd7e3713afc455/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77696c6672656564692f6c61726176656c2d736974652d70726f74656374696f6e)](LICENSE) [![Packagist Downloads](https://camo.githubusercontent.com/040e828f245e219cfb91ffeb4e847c56a49ee82dd90304254544982a1b21c615/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77696c6672656564692f6c61726176656c2d736974652d70726f74656374696f6e)](https://packagist.org/packages/wilfreedi/laravel-site-protection) [![Packagist Version](https://camo.githubusercontent.com/9b32bcb160f7907e5c6b7b4c5f1ed8862659460f8f1547a9a650a87b35441efd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77696c6672656564692f6c61726176656c2d736974652d70726f74656374696f6e)](https://packagist.org/packages/wilfreedi/laravel-site-protectioni)

Базовая защита сайта на laravel

Простоя защита сайта на laravel
===============================

[](#простоя-защита-сайта-на-laravel)

Возможности

1. Установить лимит на кол-во заходов пользователя за n времени
2. Установить лимит на кол-во заходов пользователя на старницу 404
3. Идентификация ботов по useragent

При достижении лимитов или идентификации бота, происходит редирект на страницу проверки с капчей, после успешной прохождении капчи, ip адрес заносится в белый список на 1 час

Установка
---------

[](#установка)

`composer require wilfreedi/laravel-site-protection`

### Добавление middleware

[](#добавление-middleware)

Добавить middleware в `app/Http/Kernel.php` или на конкретный маршрут

```
protected $middlewareGroups = [
    'web' => [
        ...
        \Wilfreedi\SiteProtection\Middleware\SiteProtectionMiddleware::class
    ],
    ...
];
```

### Проверка работы JS у пользователя

[](#проверка-работы-js-у-пользователя)

1. Включаем в настройках проверку JS `js.check` = `true`
2. Генерируем рандомный ключ AES-128 (длина 16 байт) и добавляем его в `js.key`, он будет использоваться для шифрования передаваемых данных с JS на сервер
3. Выводим сгенерированный ключ в шапке сайта ``
4. Подключаем JS скрипт проверки ``(JS скрипт нужно опубликовать у себя, через команду публикации файла настроек)

Публикация файла настроек
-------------------------

[](#публикация-файла-настроек)

`php artisan vendor:publish --provider="Wilfreedi\SiteProtection\SiteProtectionServiceProvider"`

### Что входит в настройки

[](#что-входит-в-настройки)

КлючТипЗначениеЧто делает`enabled``bool``true/false`включение защиты сайта`theme_color``string``white/black`цвет темы на странице проверки капчи`description``string``Мы заме..`текст, выводится на странице капчи`js.check``bool``true/false`проверка, что js включен`js.key``string``1234567890abcdef`ключ для шифрования передаваемых данных через js на сервер, AES-128 (длина 16 байт)`captcha.provider``string``recaptcha/yandex`сервис капчи`bots.enabled_all``bool``true/false`включение отправки на капчу всех, у кого в useragent есть вхождение - bot`bots.blocked``array``['Bytespider'...]`название ботов для блокировки`bots.allowed``array``['Yandexbot'...]`название ботов, которых пропускам(в случа если включен bots.enabled\_all, но нужно пропустить ботов, например яндекс)`rate_limiting.max_requests``int``5`максимальное кол-во запросов`rate_limiting.time``int``1`за какое время (секунды)`404_protection.max_404_errors``int``5`максимальное кол-во ответов 404`404_protection.time``int``15`за какое время (секунды)`exclude_paths``array``['panel'...]`список страниц, которые нужно исключить из защиты### Рекомендации

[](#рекомендации)

Сохранение текущего состояния пользователя(кол-во заходов, черный/белый список) находится в кэше
Рекомендуется установить кеширование в redis

```
CACHE_DRIVER=redis

```

Сообщить о проблеме
-------------------

[](#сообщить-о-проблеме)

Если вы обнаружите ошибку или у вас есть предложения по улучшению библиотеки, пожалуйста [напишите нам](https://github.com/wilfreedi/laravel-site-protection/issues/new/choose)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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 ~1 days

Total

10

Last Release

465d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1355cb05e7c6c78d53a0aeab5ac3263138735659009cdaa4c9b7b21601d22c4f?d=identicon)[wilfreedi](/maintainers/wilfreedi)

---

Top Contributors

[![wilfreedi](https://avatars.githubusercontent.com/u/40352982?v=4)](https://github.com/wilfreedi "wilfreedi (20 commits)")

---

Tags

laravelmiddleware

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wilfreedi-laravel-site-protection/health.svg)

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

###  Alternatives

[akaunting/laravel-firewall

Web Application Firewall (WAF) package for Laravel

999465.8k2](/packages/akaunting-laravel-firewall)[paragonie/certainty

Up-to-date, verifiable repository for Certificate Authorities

2642.4M20](/packages/paragonie-certainty)[dgtlss/warden

A Laravel package that proactively monitors your dependencies for security vulnerabilities by running automated composer audits and sending notifications via webhooks and email

8745.6k](/packages/dgtlss-warden)[acmephp/core

Raw implementation of the ACME protocol in PHP

38973.7k7](/packages/acmephp-core)[nickurt/laravel-pwned-passwords

PwnedPasswords for Laravel 11.x/12.x/13.x

187.5k](/packages/nickurt-laravel-pwned-passwords)

PHPackages © 2026

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