Download the PHP package otzy/intensity-throttle without Composer

On this page you can find all versions of the php package otzy/intensity-throttle. 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 intensity-throttle

IntensityThrottle

With IntensityThrottle package you can easily limit the rate of events of any kind. For example you can keep an eye on the rate of requests to your servers or the rate of errors in cron jobs.

IntensityThrottle implements Leaky Bucket algorithm, which means that you are able to set not only bandwidth, but burstiness as well. That is to say, short spikes in the event rate are possible.

Due to the nature of php, the leakage happens not on regular basis (not continuously), but at the moment when an event is being handled. This changes the behavior of buckets a bit, but in the end they do their job.

Usage

Package comes with InProcessStorage, which can be used when you need to limit events in the single process, for example in a long running cron job:

If you want to throttle web requests or any other events across different requests and/or servers, you should use memcached server. You can use Memcached class directly as a storage:

Bucket volume

$throttle->addLimit($max_drops, $time_span) adds a bucket with volume=$max_drops.

At first glance, $throttle->addLimit(3, 1) and $throttle->addLimit(6, 2) are the same. The second bucket has twice bigger volume and twice higher leakage rate. So if the average rate of incoming events will be 3 events/second, both buckets will not overflow.

The difference is that second bucket is capable to support a higher burstiness rate, i.e. temporary unevenness in the event flow.

The example above (with bucket volume = 3) will stop after 2.255 seconds. If you replace $throttle->addLimit(3, 1) with $throttle->addLimit(6, 2), the script will stop after 5.26 seconds.


All versions of intensity-throttle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
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 otzy/intensity-throttle contains the following files

Loading the files please wait ....