2017 © Pedro Peláez
 

library php-valve

Resource or API rate limiting/throttling

image

jitendra/php-valve

Resource or API rate limiting/throttling

  • Tuesday, March 6, 2018
  • by jitendrakkkk
  • Repository
  • 0 Watchers
  • 2 Stars
  • 72 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Build Status Latest Version, (*1)

php-valve

Resource or API rate limiting/throttling., (*2)

Installation

composer require jitendra/php-valve

Usage Example

// Instantiate limiter that allows 200 attempts per minute.
// Optionally pass custom \Predis\Client client.
$limiter = new \Jitendra\PhpValve\FixedBasic\Redis(60000, 200);
// Attempts passed resource, Optionally pass cost value.
$limiter->attempt('ip:resource');

// [
//     1,              // Allowed?
//     200,            // X-RateLimit-Limit
//     199,            // X-RateLimit-Remaining
//     1516612980700,  // X-RateLimit-Reset (in milliseconds)
//     1516612980700,  // X-RateLimit-RetryAfter (in milliseconds, -1 if not rate limited)
// ]

Implementation

  • Fixed Basic, (*3)

    (Redis), (*4)

    Rate limit attempt to a resource by specifying limit for fixed duration. E.g. 100 attempts per minute., (*5)

  • Leaky Bucket, (*6)

    (Redis), (*7)

    Rate limit attempt to a resource via standard leaky bucket logic. E.g. With max burst of 200 and leak rate of 10 requests per second., (*8)

The Versions

06/03 2018

dev-master

9999999-dev

Resource or API rate limiting/throttling

  Sources   Download

The Requires

 

The Development Requires

php redis rate-limiting api-throttling

06/03 2018

dev-hash

dev-hash

Resource or API rate limiting/throttling

  Sources   Download

The Requires

 

The Development Requires

php redis rate-limiting api-throttling

26/02 2018

dev-review2

dev-review2

Resource or API rate limiting/throttling

  Sources   Download

The Requires

 

The Development Requires

php redis rate-limiting api-throttling

01/02 2018

1.0.3

1.0.3.0

Resource or API rate limiting/throttling

  Sources   Download

The Requires

 

The Development Requires

php redis rate-limiting api-throttling

30/01 2018

1.0.2

1.0.2.0

Resource or API rate limiting/throttling

  Sources   Download

The Requires

 

The Development Requires

php redis rate-limiting api-throttling

25/01 2018

1.0.1

1.0.1.0

Resource or API rate limiting/throttling

  Sources   Download

The Requires

 

The Development Requires

php redis rate-limiting api-throttling

22/01 2018

1.0.0

1.0.0.0

Resource rate limiting/throttling

  Sources   Download

The Requires

 

The Development Requires

php rate-limiting api-throttling