Download the PHP package maatify/php-rate-limiter without Composer

On this page you can find all versions of the php package maatify/php-rate-limiter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-rate-limiter

# Maatify Rate Limiter ![Maatify.dev](https://www.maatify.dev/assets/img/img/maatify_logo_white.svg) [![Status](https://img.shields.io/badge/Status-Release%20Candidate-orange)](CHANGELOG.md) [![Version](https://img.shields.io/badge/Version-1.0.0--rc.4-orange)](CHANGELOG.md) [![PHP 8.4+](https://img.shields.io/badge/PHP-8.4%2B-777BB4.svg)](composer.json) [![License: Proprietary](https://img.shields.io/badge/License-Proprietary-red.svg)](LICENSE) [![PHPStan Level Max](https://img.shields.io/badge/PHPStan-Level%20Max-4F5B93.svg)](phpstan.neon) [![Registry: Packagist](https://img.shields.io/badge/Registry-Packagist-blue)](https://packagist.org/packages/maatify/php-rate-limiter) [![Monthly Downloads](https://img.shields.io/packagist/dm/maatify/php-rate-limiter)](https://packagist.org/packages/maatify/php-rate-limiter) [![Total Downloads](https://img.shields.io/packagist/dt/maatify/php-rate-limiter)](https://packagist.org/packages/maatify/php-rate-limiter) [![Maatify Ecosystem](https://img.shields.io/badge/Maatify-Ecosystem-blueviolet)](https://github.com/Maatify) [![Install 1.0.0-rc.4](https://img.shields.io/badge/Install-1.0.0--rc.4-blue)](https://packagist.org/packages/maatify/php-rate-limiter) [![Usage Guide](https://img.shields.io/badge/Docs-Usage%20Guide-blue.svg)](docs/guides/USAGE_GUIDE.md) [![Examples](https://img.shields.io/badge/Docs-Examples-blue.svg)](examples/) [![Package Reference](https://img.shields.io/badge/Docs-Package%20Reference-blue.svg)](RATE_LIMITER_PACKAGE_REFERENCE.md) [![Changelog](https://img.shields.io/badge/Docs-Changelog-blue.svg)](CHANGELOG.md) [![Security Policy](https://img.shields.io/badge/Docs-Security%20Policy-blue.svg)](SECURITY.md) [![Contributing Guide](https://img.shields.io/badge/Docs-Contributing-blue.svg)](CONTRIBUTING.md) PHP library for deterministic, multi-signal rate-limit decisions.

Package Status

This artifact is Release Candidate 1.0.0-rc.4. Publication State at qualification: unpublished; this document does not claim that 1.0.0-rc.4 is externally available until it is Published. The latest externally Published Release Candidate at qualification was 1.0.0-rc.3 (published to Packagist on 2026-10-07). No Published Stable release or Stable support line exists. It is proprietary software; repository visibility and registry presence do not grant open-source or general usage rights. Authorized use requires written authorization or an applicable written license agreement from Maatify.

Key Features

Requirements

Installation

Install the exact Release Candidate target (available once 1.0.0-rc.4 is Published):

Use remains subject to written authorization or an applicable written license agreement from Maatify.

Usage

The production default path is one RateLimiterConfig, one official Redis RedisFullCapabilityStore or Host implementation of FullCapabilityStoreInterface, and the named Builder convenience path. The Host retains ownership of the Redis client/connection lifecycle and supplies a command executor. See the Usage Guide for the integration contract and basic runnable example for a complete in-memory assembly.

For the official Redis adapter, construct RedisFullCapabilityStore with the Host-owned RedisCommandExecutorInterface (or CallableRedisCommandExecutor) and pass that store as $fullCapabilityStore.

Advanced composition path

Consumers that intentionally keep separate storage boundaries may use the lower-level multi-store constructor:

FullCapabilityStoreInterface adds no methods of its own. The package includes an official optional non-clustered Redis implementation under Repository\\Redis, but consumers choosing another backend still install the package without a Redis extension or client. Redis consumers own the concrete client and pass commands through RedisCommandExecutorInterface or CallableRedisCommandExecutor.

Public Runtime API

RateLimiterInterface::limit() is the framework-agnostic consumer entrypoint. Hosts provide a RateLimitContextDTO and a RateLimitCommand, then handle the returned RateLimitResultDTO at their transport boundary.

The additive simple fixed-window enforcement path is:

RateLimiterBuilder → withSimpleThrottlePolicy(...) → build() → CompositeRateLimiterRuntimeInterface → SimpleRateLimiterInterface::consume(policyName, subject, cost = 1) → SimpleRateLimitResultDTO.

It is an opt-in weighted quota path governed by DEC-013 and DEC-014; it does not replace the existing score-based RateLimiterInterface::limit() path.

The default Login and OTP policies opt into DEC-007 generation-bound K4 post-punishment re-entry. Consumers that need the one-shot application handoff may type-hint RateLimiterRuntimeInterface and call claimPostPunishmentReentry() using only public metadata from a valid checkOnly result. API Heavy and non-opt-in policies retain normal score/decay behavior.

The public runtime surface also includes the login_protection, otp_protection, and api_heavy_protection policy presets; typed context, command, result, identity, state, operational snapshot, and metadata DTOs; RateLimitOperationalReaderInterface::read() for read-only point-in-time operational inspection; and extension contracts for rate-limit storage, the aggregate full-capability storage contract (FullCapabilityStoreInterface), atomic L2+ hard-block cycle tracking (HardBlockCycleStoreInterface), correlation storage, circuit-breaker state, failure signals, device identity resolution, and custom policies. A base-only rate-limit store remains compatible for reads and L1 writes, but L2+ persistence requires the additive hard-block cycle capability.

RateLimiterBuilder::buildOperationalReader() (DEC-012) is the Production Default Read Path for Operational Read: it returns CompositeRateLimitOperationalReaderInterface, built from the Builder's own current registered state, so readScorePolicy(context, policyName) and readSimpleThrottle(policyName, subject) resolve the exact same score/simple policy definitions, clock, device resolver, and key configuration the Builder's build() enforces with — no Host reconstruction of policy semantics and no second BlockPolicyInterface needed. The existing RateLimitOperationalReaderInterface/RateLimitOperationalReader remain fully available as the Advanced Path. Simple fixed-window persisted state (DEC-013) is included in the Operational Read classification via SimpleRateLimitOperationalReaderInterface/SimpleRateLimitOperationalReader and SimpleRateLimitOperationalSnapshotDTO; this is a read-only inspection, not a second consume().

For DEC-007, the Redis lifecycle primitive atomically couples the generation-bound K4 score, L2+ block, score-expiry evidence, and generation fence. Reads use a coherent current/previous snapshot at the request's time (the Host clock, read once per call); active blocks suppress evidence for every command. The claim does not consume punishment satisfaction or evidence; it consumes only the one-shot application handoff marker, so replay is safe. Custom opt-in authentication policies must implement the policy marker and lifecycle capability; API Heavy remains outside this flow.

The Package Reference contains the complete public interface, command, DTO, concrete service, policy, and extension-boundary inventory. Runtime behavior is defined by the current source and the linked decision, policy, device, key, and failure documents.

Exception and Error Propagation

Only an explicitly classified operational backend failure represented by BackendFailureException enters the score-runtime circuit and bounded fallback. Invalid input, configuration, missing capability, malformed or corrupt state, programming failures, and unknown or untyped throwables retain their explicit package/contract exception behavior; Host adapters must not reclassify unknown failures as backend outages. The enforcement path owns the resulting score failure decision, while the read-only operational reader does not convert integration failures into an enforcement result. Simple fixed-window storage failures remain the separate DEC-013 FAIL_CLOSED contract.

See Package Reference for the detailed failure contract.

Transaction and Concurrency Boundary

The package does not open a general database transaction or own backend locks around RateLimiterInterface::limit(). Concrete host store implementations own the transaction, locking, and native atomic primitives required by their backend, and every operation declared atomic by the package contracts must remain atomic.

There is no package-level distributed transaction across the rate-limit, correlation, circuit-breaker, and failure-signal boundaries, and the package does not promise a shared atomic commit with the host application's business transaction.

See the Package Reference for the full transaction, locking, and concurrency contract.

Security and Trust Boundaries

The host remains the authority for account, session, authentication, authorization, and previously verified device truth. Device fingerprinting is a bounded risk signal used for rate-limit decisions; it is not authentication, proof of device ownership, or a cross-context tracking identity.

The package keeps transport behavior and host business identity outside its boundary, and its operational read API does not expose raw storage keys, raw fingerprint material, or host-owned records.

Threat-model limits. Policies that do not opt into the admission reservation keep the DEC-027 posture: clients that share an IP prefix and user agent behind NAT can be blocked together, and trusted sessions on several accounts are bounded per account but not across accounts. The admission policy (the active decisions DEC-022, DEC-023, DEC-024, DEC-026, DEC-033, DEC-034 and DEC-035, as listed in Decision Matrix §12) is the supported alternative. The limits, with their measured numbers, are in Decision Matrix §10.1.

See Package Reference for the detailed contracts.

Documentation

Quality Status

The repository quality gate covers strict Composer validation, dependency compatibility, platform requirements, PHP syntax, PHPStan at level max, the full PHPUnit suite, the focused composer test:integration suite, standalone example smoke execution, Composer security auditing, workflow linting, and whitespace verification. The package is a pre-release (Release Candidate) and has no Published Stable release or Stable support line.

License

Proprietary. All rights reserved. See LICENSE.

👤 Author

Engineered by Mohamed Abdulalim (@megyptm)
Backend Lead & Technical Architect
https://www.maatify.dev


[Built with ❤️ by Maatify.dev — Unified Ecosystem for Modern PHP Libraries](https://www.maatify.dev)

All versions of php-rate-limiter with dependencies

PHP Build Version
Package Version
Requires ext-date Version *
ext-filter Version *
ext-hash Version *
ext-json Version *
ext-pcre Version *
ext-random Version *
maatify/exceptions Version ^1.0
maatify/shared-common Version ^1.0
php Version ^8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package maatify/php-rate-limiter contains the following files

Loading the files please wait ...