Download the PHP package charcoal/cache without Composer

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

Charcoal Cache

The Cache package provides an integration with Stash for caching the results of expensive tasks.

Installation

For Charcoal projects, the service provider can be registered from your configuration file:

Overview

Service Provider

Parameters

Services

Configuration

Pool Configuration

Each pool comes with a set of default options which can be individually overridden.

Setting Type Default Description
active boolean TRUE Whether to enable or disable the cache service.
prefix string charcoal Name of the main Stash pool.
types string[] memory List of cache drivers to choose from for the main Stash pool. Defaults to "memory".
default_ttl integer 1 week Default time-to-live (in seconds) for a cached item. Currently, only used by the APC driver (cache/drivers.apc).

Driver Configuration

Each driver comes with a set of default options which can be individually overridden.

—N/A—

Usage

Just fetch the default cache pool service:

Or a custom-defined cache pool:

Then you can use the cache service directly:

See the Stash documentation for more information on using the cache service.

Middleware

The PSR-6 cache pool and returns that cached response if still valid.

If you are using charcoal/app, you can add the middleware via the application configset:

Otherwise, with Slim, for example:

The middleware comes with a set of default options which can be individually overridden.

Setting Type Default Description
active boolean FALSE Whether to enable or disable the middleware (charcoal/app only).
cache CacheItemPoolInterface cache Required; The main Stash pool.
ttl string[] 1 week Time-to-live (in seconds) for a cached response.
methods string[] GET Accepted HTTP method(s) to cache the response.
status_codes integer[] 200 Accepted HTTP status code(s) to cache the response.
included_path string[] * Accepted URI paths for caching the response.
excluded_path string[] ^/admin\b Rejected URI paths for caching the response.
included_query string[] NULL Accepted query parameters for caching the response.
excluded_query string[] NULL Rejected query parameters for caching.
ignored_query string[] NULL Ignored query parameters for caching the response.

By Default

All HTTP responses are cached unless:

  1. the request method is not GET
  2. the request URI path starts with /admin…
  3. the request URI contains a query string
  4. the response is not OK (200)

Ignoring Query Strings

If query strings don't affect the server's response, you can permit caching of requests by ignoring all query parameters:

or some of them:

Helpers

CachePoolAwareTrait

The CachePoolAwareTrait is offered as a convenience to avoid duplicate / boilerplate code. It simply sets and gets an instance of \Psr\Cache\CacheItemPoolInterface.

Assign a cache pool with setCachePool() and retrieve it with cachePool().

Both methods are protected; this trait has no public interface.

Resources


All versions of cache with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
charcoal/config Version ^5.0
pimple/pimple Version ^3.0
psr/cache Version ^1.0
tedivm/stash Version ~0.16
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 charcoal/cache contains the following files

Loading the files please wait ....