Download the PHP package guzzlehttp/cache-subscriber without Composer

On this page you can find all versions of the php package guzzlehttp/cache-subscriber. 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 cache-subscriber


Guzzle Cache Subscriber

Provides a private transparent proxy cache for caching HTTP responses.

Here's a simple example of how it's used:

use GuzzleHttp\Client;
use GuzzleHttp\Subscriber\Cache\CacheSubscriber;

$client = new Client(['defaults' => ['debug' => true]]);

// Use the helper method to attach a cache to the client.
CacheSubscriber::attach($client);

// Send the first request
$a = $client->get('http://en.wikipedia.org/wiki/Main_Page');

// Send the second request. This will find a cache hit which must be
// validated. The validation request returns a 304, which yields the original
// cached response.
$b = $client->get('http://en.wikipedia.org/wiki/Main_Page');

Running the above code sample should output verbose cURL information that looks something like this:

> GET /wiki/Main_Page HTTP/1.1
Host: en.wikipedia.org
User-Agent: Guzzle/4.2.1 curl/7.37.0 PHP/5.5.13
Via: 1.1 GuzzleCache/4.2.1

< HTTP/1.1 200 OK
< Server: Apache
< X-Content-Type-Options: nosniff
< Content-language: en
< X-UA-Compatible: IE=Edge
< Vary: Accept-Encoding,Cookie
< Last-Modified: Thu, 21 Aug 2014 01:51:49 GMT
< Content-Type: text/html; charset=UTF-8
< X-Varnish: 2345493325, 1998949714 1994269567
< Via: 1.1 varnish, 1.1 varnish
< Transfer-Encoding: chunked
< Date: Thu, 21 Aug 2014 02:34:12 GMT
< Age: 2541
< Connection: keep-alive
< X-Cache: cp1055 hit (1), cp1068 frontend hit (25353)
< Cache-Control: private, s-maxage=0, max-age=0, must-revalidate
< Set-Cookie: GeoIP=US:Seattle:47.6062:-122.3321:v4; Path=/; Domain=.wikipedia.org
<
* Connection #0 to host en.wikipedia.org left intact
* Re-using existing connection! (#0) with host en.wikipedia.org
> GET /wiki/Main_Page HTTP/1.1
Host: en.wikipedia.org
User-Agent: Guzzle/4.2.1 curl/7.37.0 PHP/5.5.13
Via: 1.1 GuzzleCache/4.2.1, 1.1 GuzzleCache/4.2.1
If-Modified-Since: Thu, 21 Aug 2014 01:51:49 GMT

< HTTP/1.1 304 Not Modified
< Server: Apache
< X-Content-Type-Options: nosniff
< Content-language: en
< X-UA-Compatible: IE=Edge
< Vary: Accept-Encoding,Cookie
< Last-Modified: Thu, 21 Aug 2014 01:51:49 GMT
< Content-Type: text/html; charset=UTF-8
< X-Varnish: 2345493325, 1998950450 1994269567
< Via: 1.1 varnish, 1.1 varnish
< Date: Thu, 21 Aug 2014 02:34:12 GMT
< Age: 2541
< Connection: keep-alive
< X-Cache: cp1055 hit (1), cp1068 frontend hit (25360)
< Cache-Control: private, s-maxage=0, max-age=0, must-revalidate
< Set-Cookie: GeoIP=US:Seattle:47.6062:-122.3321:v4; Path=/; Domain=.wikipedia.org
<
* Connection #0 to host en.wikipedia.org left intact

Installing

Add the following to your composer.json:

{
    "require": {
        "guzzlehttp/cache-subscriber": "0.2.*@dev"
    }
}

or

$ composer require guzzlehttp/cache-subscriber

Creating a CacheSubscriber

The easiest way to create a CacheSubscriber is using the attach() helper method of GuzzleHttp\Subscriber\Cache\CacheSubscriber. This method accepts a request or client object and attaches the necessary subscribers used to perform cache lookups, validation requests, and automatic purging of resources.

The attach() method accepts the following options:

storage A GuzzleHttp\Subscriber\Cache\CacheStorageInterface object used to store cached responses. If no value is not provided, an in-memory array cache will be used. validate A Boolean value that determines if cached response are ever validated against the origin server. This setting defaults to true but can be disabled by passing false. purge A Boolean value that determines if cached responses are purged when non-idempotent requests are sent to their URI. This setting defaults to true but can be disabled by passing false. can_cache An optional callable used to determine if a request can be cached. The callable accepts a GuzzleHttp\Message\RequestInterface and returns a Boolean value. If no value is provided, the default behavior is utilized.


All versions of cache-subscriber with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
guzzlehttp/guzzle Version ~5.0
doctrine/cache Version ~1.3
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 guzzlehttp/cache-subscriber contains the following files

Loading the files please wait ....