2017 © Pedro Peláez
 

library magento-rate-limit

Rate Limiting Library With Token Bucket Algorithm with Magento Adapter

image

dcabrejas/magento-rate-limit

Rate Limiting Library With Token Bucket Algorithm with Magento Adapter

  • Tuesday, July 4, 2017
  • by dcabrejas
  • Repository
  • 0 Watchers
  • 0 Stars
  • 831 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 49 % Grown

The README.md

magento-rate-limit

Magento 2 adapter for the touhonoob/RateLimit Library, (*1)

Installation

composer require dcabrejas/magento-rate-limit

Usage

//Inject the adapter via dependency injection
public function __construct(\Dcabrejas\RateLimit\Adapter\Magento $magentoAdapter)
{
  $this->magentoAdapter = $magentoAdapter;
}


$rateLimit = new \Touhonoob\RateLimit\RateLimit("myratelimit", 100, 3600, $this->magentoAdapter); // 100 Requests / Hour

$id = $_SERVER['REMOTE_ADDR']; // Use client IP as identity
if ($rateLimit->check($id) > 0) {
  echo "passed";
} else {
  echo "rate limit exceeded";
}

The Versions

04/07 2017

dev-master

9999999-dev

Rate Limiting Library With Token Bucket Algorithm with Magento Adapter

  Sources   Download

MIT

The Requires

 

by Avatar dcabrejas

04/07 2017

1.0.0

1.0.0.0

Rate Limiting Library With Token Bucket Algorithm with Magento Adapter

  Sources   Download

MIT

The Requires

 

by Avatar dcabrejas