PHPackages                             swayok/laravel-antihack-tool - 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. swayok/laravel-antihack-tool

ActiveLibrary[Security](/categories/security)

swayok/laravel-antihack-tool
============================

Active anti-hack protection for Laravel

580PHP

Since Nov 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/swayok/laravel-antihack-tool)[ Packagist](https://packagist.org/packages/swayok/laravel-antihack-tool)[ RSS](/packages/swayok-laravel-antihack-tool/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

What is this?
=============

[](#what-is-this)

This is active anti-hack protection tool that will guard your project from most hack attempts that use HTTP requests. It also contains whitelist and blacklist functionality based on config files or database table contents

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

[](#installation)

Add `"swayok/laravel-antihack-tool": "master-dev"` to your `composer.json`into `require` section and run `composer update`

Activation
----------

[](#activation)

### For Laravale 5.5+

[](#for-laravale-55)

Service provider will be automatically loaded

### For Laravel 5.4-

[](#for-laravel-54-)

Add `LaravelAntihackTool\AntihackServiceProvider` to yor `app.providers` config

### Add section to your CMF section

[](#add-section-to-your-cmf-section)

Add `\LaravelAntihackTool\PeskyCmf\CmfHackAttempts\CmfHackAttemptsScaffoldConfig::class`to your cmf section's config (probably `config/admin.php`) into `'resources'` key:

```
    'resources' => [
        \LaravelAntihackTool\PeskyCmf\CmfHackAttempts\CmfHackAttemptsScaffoldConfig::class
    }

```

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

[](#configuration)

1. Run `php artisan vendor:publish --provider=LaravelAntihackTool\AntihackServiceProvider`to publish configuration file
2. If you plan to use database to store hack attempts - set `antihack.store_hack_attempts`configuration paramenter to `true` and modify `antihack.connection` and `antihack.table_name`configuration paramenters if needed. Then run `php artisan antihack:install` and confirm migration task. On production server you will need to run migration manually using `php artisan migrate` command.
3. If you're using PeskyCmf or PeskyCms - you may need to add a menu item for resource in your `menu()` method of your `AdminConfig` class (or other class that extends `CmfConfig` class). Menu item: `static::getMenuItem('hack_attempts')` or your custom one.
4. On development server you may need to set `antihack.allow_localhost_ip` to `true` in order to allow requests from `127.0.0.1` ip. By default this option is set to `true` for `local` environment and to `false` for any other environments.
5. I you use any urls that have `.php` extensions - set `antihack.allow_php_extension_in_url` to `true`.
6. Whitelists and blacklists are generated automatically and cached to your default cache provider. You may change cache key and duration configuration paramenters if you need. Also you may update cache using `php artisan antihack:blacklist` manually.
7. There are 2 error templates in this package: `'antihack::errors.406'`(hack detected) and `'antihack::errors.423'` (ip or user agent is blacklisted/banned). In Laravel 5.5+ you will need to modify your `App\Exceptions\Handler` class like this to use them:

    ```
     public function prepareResponse($request, Exception $exception) {
         if ($exception instanceof \LaravelAntihackTool\Exception\AntihackException) {
             return response()->view('antihack::errors.' . $exception->getStatusCode());
         }
         return parent::prepareResponse($request, $exception);
     }

    ```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a631e17770f1ef26d05cbc896e14b218d186973a00a515eed2d86fbc9eb936a?d=identicon)[sway](/maintainers/sway)

---

Top Contributors

[![swayok](https://avatars.githubusercontent.com/u/629675?v=4)](https://github.com/swayok "swayok (33 commits)")

### Embed Badge

![Health badge](/badges/swayok-laravel-antihack-tool/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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