Download the PHP package phlak/stash without Composer

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

Lightweight PHP caching library • Created by Chris Kankiewicz (@PHLAK)

Join our Community Become a Sponsor One-time Donation
Latest Stable Version Total Downloads License GitHub branch checks state


Introduction

Stash is a lightweight PHP caching library supporting multiple, interchangeable caching back-ends and an expressive (Laravel inspired) API.

Supported caching back-ends:

Requirements

Install with Composer

Initializing the Client

First, import Stash:

Then instantiate Stash for your back-end of choice with the named constructor:

The $config parameter accepts a driver-specific closure for setting configuration options for your chosen driver. Refer to the specific documentation about each driver below for more info. Not all drivers require a configuration function.

Alternatively you may use the Stash\Cache::make() factory method to instantiate your driver.

The make() method takes two parameters. The first ($driver) should be one of the following lowercase strings representing your desired caching driver.

The second ($config) is the same driver-specific configuration closure as when using a named constructor. Refer to the specific documentation about each driver below for more info.


File Cache

The file cache configuration closure must call $this->setCacheDir($path) where $path is a path to a valid directory in which your cache files will be stored.

Memcached

The Memcached configuration closure receives an instance of the Memcached object as it's only parameter, you can use this parameter to connect and configure Memcached. At a minimum you must connect to one or more Memcached servers via the addServer() or addServers() methods.

Reference the PHP Memcached documentation for additional configuration options.

Redis

The Redis configuration closure receives an instance of the Redis object as it's only parameter, you can use this parameter to connect to and configure Redis. At a minimum you must connect to one or more Redis servers via the connect() or pconnect() methods.

Reference the phpredis documentation for additional configuration options.

APCu

The APCu driver caches items in PHPs APC user cache.

The APCu driver does not require a configuration closure. However, if you wish to set a cache prefix you may pass a configuration closure that calls $this->setPrefix($prefix) where $prefix is a string of your desired prefix.

Ephemeral

The Ephemeral driver caches items in a PHP array that exists in memory only for the lifetime of the script. The Ephemeral driver does not take a configuration closure.

Usage

Cacheable::put( string $key , mixed $data [, $minutes = 0 ] ) : bool

Add an item to the cache for a specified duration.

Examples

Cacheable::forever( string $key , mixed $data) : bool

Add an item to the cache permanently.

Examples

Cacheable::get( string $key [, $default = false ] ) : mixed

Retrieve an item from the cache.

Examples

Cacheable::has( string $key ) : bool

Check if an item exists in the cache.

Examples

Cacheable::remember( string $key , int $minutes , Closure $closure ) : mixed

Retrieve item from cache or, when item does not exist, execute a closure. The result of the closure is then stored in the cache for the specified duration and returned for immediate use.

Examples

Cacheable::rememberForever( string $key , Closure $closure ) : mixed

Retrieve item from cache or, when item does not exist, execute a closure. The result of the closure is then stored in the cache permanently.

Examples

Cacheable::increment( string $key [, int $value = 1 ] ) : mixed

Increment an integer already stored in the cache.

Examples

Cacheable::decrement( string $key [, int $value = 1 ] ) : mixed

Decrement an integer already stored in the cache.

Examples

Cacheable::touch( string|array $key [, int $minutes = 0 ] ) : bool

Extend the expiration time for an item in the cache.

Examples

Cacheable::forget( string $key ) : bool

Remove an item from the cache.

Examples

Cacheable::flush() : bool

Delete all items from the cache.

Examples

Changelog

A list of changes can be found on the GitHub Releases page.

Troubleshooting

For general help and support join our GitHub Discussions or reach out on Twitter.

Please report bugs to the GitHub Issue Tracker.

Copyright

This project is licensed under the MIT License.


All versions of stash with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
nesbot/carbon Version ^1.21 || ^2.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 phlak/stash contains the following files

Loading the files please wait ....