Download the PHP package rmanara/brutalforce without Composer
On this page you can find all versions of the php package rmanara/brutalforce. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rmanara/brutalforce
More information about rmanara/brutalforce
Files in rmanara/brutalforce
Package brutalforce
Short Description help on secure website against brutal force attack
License MIT
Homepage https://github.com/rodrigomanara/brutalforce
Informations about the package brutalforce
BrutalForce
BrutalForce is a lightweight PHP library that helps detect suspicious request cadence per client IP using session-backed timing.
Requirements
- PHP 8.2+
Installation
Quick Start
Public API
Initiate::Rate(): stringreturns the current risk label.Initiate::predict(): floatreturns the current average timing score.Initiate::decision(): arrayreturns blocking decision payload.Initiate::isBlocked(): boolchecks if the client is currently locked.Initiate::lockRemaining(): intreturns seconds left in lockout.Initiate::policy(): arrayreturns effective policy values.Initiate::withRedis(object $redis, array $policy = [], array $options = []): Initiatecreates an instance backed by Redis.
Blocking Example
Policy Configuration
You can configure protection policy per instance:
Or using environment variables:
Progressive lockouts increase duration for repeated offenders in the same session.
Policy precedence is: constructor overrides > environment variables > built-in defaults.
Advanced Runtime Options
The second constructor argument accepts runtime integrations:
Redis Quick Start
See examples/redis.php for a complete runnable example.
Rate Labels
The library maps the score to one of the following labels:
VERY LOWLOWMEDIUMMEDIUM HIGHHIGHVERY HIGH
Running Tests
Run Simulations
Use the CLI runner to simulate burst and delayed request patterns:
Optional examples:
Redis-backed simulation (local in-memory Redis stub):
Migration Notes (legacy 5.6-era to modern PHP)
- Runtime target is now PHP 8.2+.
- Core internals use strict return types and safer session access.
- Learning history is bounded per IP to avoid unbounded session growth.
Rate()remains backward compatible.
Full Documentation
For behavior details, integration guidance, and upgrade notes, see:
docs/Documentation.md
Project
- Package:
rmanara/brutalforce - Repository: https://github.com/rodrigomanara/brutalforce
- License: MIT