Download the PHP package genai/rate-limit without Composer

On this page you can find all versions of the php package genai/rate-limit. 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 rate-limit

genai/rate-limit

Fixed-window rate limiting for the GenAI stack — a small RateLimiter over a pluggable store, plus a drop-in RateLimitInterceptor that returns 429 when a client IP exceeds the limit on a path. Brute-force and flood protection without a line of glue in your controllers. PHP 5.3.29-safe at runtime.

How it counts

A fixed window: time is sliced into window-second buckets; each (key, bucket) pair has a counter. The interceptor keys on "<ip>|<path>", so every endpoint is throttled independently — POST /login floods don't burn POST /forgot's budget. Only state-changing methods (POST/PUT/PATCH/DELETE) are counted, so normal page browsing (GET) is never throttled.

Use it

  1. Configure (app.ini) — optional; defaults are 20 requests / 60s:

  2. Expose the limiter as a bean:

  3. Enable the interceptor with a thin subclass (it stays opt-in, like CsrfInterceptor):

    Scope it to specific paths with #[Intercept(path: '/login')], or run several subclasses for different endpoints.

Account lockout (failed logins)

RateLimiter is fixed-window flood control. For "lock the account after N wrong passwords," use AttemptLimiter — it counts failures per key (e.g. an email) and locks for a fixed duration once the threshold is hit; a success clears it.

lockedFor() returns seconds remaining (0 = open); remaining() gives attempts left before a lock, for "N tries left" messaging.

Tradeoff: locking by email lets an attacker lock a victim out on purpose by failing 3× against their address. That's inherent to account lockout. If that matters, key on email|ip instead — at the cost of letting IP-rotation retry.

Notes

Layers (use any without the others)


All versions of rate-limit with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
genai/property Version *
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 genai/rate-limit contains the following files

Loading the files please wait ...