Download the PHP package zeus-server/bandwidth-throttler without Composer

On this page you can find all versions of the php package zeus-server/bandwidth-throttler. 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 bandwidth-throttler

PHP Bandwidth Throttler

Introduction

This library can be used to limit (throttle) the speed of files served for download.

It intercepts the PHP script output by setting a buffering handler that is called every time a given number of bytes are served to the browser.

The library measures the time since the last time the PHP output buffer was flushed and hold on PHP for a while if the average download speed is above a given limit.

Example

Features

There are three different bandwidth shaping mechanisms to ensure adequate Quality of Service:

Sample usage

Example #1

Throttling by download duration (send files at the speed of 50.000 bytes for the first 30 seconds, then slow down to the 15.000 bytes per second)

Example #2:

Throttling by file size (send small files at the speed of 50.000 bytes per second, and bigger ones at the speed of 15.000 bytes per second)

See example.php and example2.php for working implementation.

Details

Terms definitions: Throttling process, Quality of Service

Throttling process (computing)

In software, a throttling process, or a throttling controller as it is sometimes called, is a process responsible for regulating the rate at which application processing is conducted, either statically or dynamically.

For example, in high throughput processing scenarios, as may be common in online transactional processing (OLTP) architectures, a throttling controller may be embedded in the application hosting platform to balance the application's outbound publishing rates with its inbound consumption rates, optimize available system resources for the processing profile, and prevent eventually unsustainable consumption. In, say, an enterprise application integration (EAI) architecture, a throttling process may be built into the application logic to prevent an expectedly slow end-system from becoming overloaded as a result of overly aggressive publishing from the middleware tier.

Quality of Service

In the field of computer networking and other packet-switched telecommunication networks, the traffic engineering term quality of service (QoS) refers to resource reservation control mechanisms rather than the achieved service quality. Quality of service is the ability to provide different priority to different applications, users, or data flows, or to guarantee a certain level of performance to a data flow. For example, a required bit rate, delay, jitter, packet dropping probability and/or bit error rate may be guaranteed. Quality of service guarantees are important if the network capacity is insufficient, especially for real-time streaming multimedia applications such as voice over IP, online games and IP-TV, since these often require fixed bit rate and are delay sensitive, and in networks where the capacity is a limited resource, for example in cellular data communication.

Technical aspects and caveats of Bandwidth throttling using PHP

First of all, the PHP throttling mechanism is not a good equivalent of a low-level system traffic shaping. The major problem is that PHP takes more system resources to handle the user request than a system firewall (standard PHP process can take as much as 15-30MB of the system memory just to send a file over a network).

Another problem is that on shared hostings support for set_time_limit() function in PHP is limited (due to the safe mode or other system configuration), so when the downloaded file is too big, it has to be send to the user in more than 30 seconds (a default PHP time limit after which request is automatically aborted). In this case to send something bigger, you have to ask your system administrator to increase your time limit above 30 seconds.

The last thing to remember is that PHP can be executed on many different OS'es and APIs. For example PHP can be installed as an Apache module (mod_php.so), or as a FastCGI module (mod_fcgi + suexec), etc. In any of this scenarios there is a potential risk, that bandwidth throttling may be unsuccesfull because of the internal output buffering (see for example Apache directive "SendBufferSize" in httpd.conf, or FastCGI output buffering) which sometimes cannot be properly controlled in the PHP. In this case you have to ask your system administrator to alter configuration files respectively (this ofcourse can be problematic on shared hostings).

Pros and cons of this library

PROS:

CONS:


All versions of bandwidth-throttler with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6
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 zeus-server/bandwidth-throttler contains the following files

Loading the files please wait ....