Download the PHP package phpfastcache/phpfastcache without Composer

On this page you can find all versions of the php package phpfastcache/phpfastcache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.


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.

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?
Rate from 1 - 5
Rated 3.67 based on 3 reviews

Informations about the package phpfastcache

Total Downloads Latest Stable Version PHPSTAN Cache Interface Extended Coding Style Simple Cache Code Climate Scrutinizer Code Quality Build Status Semver compliant License Patreon

:warning: Please note that the V9 is mostly a PHP 8 type aware update of Phpfastcache with some significant changes !

As the V9 is relatively not compatible with previous versions, please read carefully the migration guide to ensure you the smoothest migration possible. One of the biggest changes is the configuration system which is now an object that replace the primitive array that we used to implement back then. Also, please note that the V9 requires at least PHP 8 or higher to works properly.

Simple Yet Powerful PHP Caching Class

More information in Wiki The simplicity of abstraction: One class for many backend cache. You don't need to rewrite your code many times again.

Supported drivers at this day *

:bulb: Feel free to propose a driver by making a new Pull Request, they are welcome !

Regular drivers High performances drivers Development drivers (Core) Cluster-Aggregated drivers (Core)
Apcu (Core)
(APC support removed)
Arangodb (Extension) Devnull FullReplicationCluster
Dynamodb (Extension) Cassandra
(PHP extension is no more maintained by Datastax, might be deprecated in v10)
Devrandom SemiReplicationCluster
Files (Core) CouchBasev3 (Core)
(Will be deprecated as of v10)
(Previously named Memstatic)
Firestore (Extension) CouchBasev4 (Extension) RandomReplicationCluster
Leveldb (Core) Couchdb (Extension)
Memcache(d) (Core) Mongodb (Extension)
Solr (Extension) Predis (Core)
Sqlite (Core) Ravendb _(Extension)
Wincache (Core)
(Deprecated as of v9.2, will be removed as of v10)
Redis/RedisCluster (Core)
Zend Disk Cache (Core) Ssdb (Core)
Zend Memory Cache (Core)

* Driver descriptions available in DOCS/

:new: As of v9.2 a new Couchbase extension has been released: Couchbasev4 Also a new driver extension has been added: Ravendb. The driver will be actively developed in the feature to allow better fine-grained configuration. This new extension is the beginning of a new era for Phpfastcache along with some others:\ Many drivers has been moved from the core to their own sub-repository as a standalone extension: Arangodb, Couchdb, Dynamodb, Firestore, Mongodb, Solr.\ They can be easily added through composer, ex: composer install phpfastcache/couchbasev4-extension However Couchbasev3 will stay in the core for compatibility reasons but will be deprecated.

Because caching does not mean weaken your code

Phpfastcache has been developed over the years with 3 main goals:

Rich Development API

Phpfastcache provides you a lot of useful APIs:

Item API (ExtendedCacheItemInterface)

Method Return Description
addTag($tagName) ExtendedCacheItemInterface Adds a tag
addTags(array $tagNames) ExtendedCacheItemInterface Adds multiple tags
append($data) ExtendedCacheItemInterface Appends data to a string or an array (push)
decrement($step = 1) ExtendedCacheItemInterface Redundant joke...
expiresAfter($ttl) ExtendedCacheItemInterface Allows you to extends the lifetime of an entry without altering its value (formerly known as touch())
expiresAt($expiration) ExtendedCacheItemInterface Sets the expiration time for this cache item (as a DateTimeInterface object)
get() mixed The getter, obviously, returns your cache object
getCreationDate() \DatetimeInterface Gets the creation date for this cache item (as a DateTimeInterface object) *
getDataAsJsonString() string Return the data as a well-formatted json string
getEncodedKey() string Returns the final and internal item identifier (key), generally used for debug purposes
getExpirationDate() ExtendedCacheItemInterface Gets the expiration date as a Datetime object
getKey() string Returns the item identifier (key)
getLength() int Gets the data length if the data is a string, array, or objects that implement \Countable interface.
getModificationDate() \DatetimeInterface Gets the modification date for this cache item (as a DateTimeInterface object) *
getTags() string[] Gets the tags
hasTag(string $tagName) bool Check if the cache item contain one specific tag
hasTags(array $tagNames, int $strategy): bool bool Check if the cache item contain one or more specific tag with optional strategy (default to TAG_STRATEGY_ONE)
isTagged(): bool bool Check if the cache item has at least one tag (v9.2)
getTagsAsString($separator = ', ') string Gets the data as a string separated by $separator
getTtl() int Gets the remaining Time To Live as an integer
increment($step = 1) ExtendedCacheItemInterface To allow us to count on an integer item
isEmpty() bool Checks if the data is empty or not despite the hit/miss status.
isExpired() bool Checks if your cache entry is expired
isHit() bool Checks if your cache entry exists and is still valid, it's the equivalent of isset()
isNull() bool Checks if the data is null or not despite the hit/miss status.
prepend($data) ExtendedCacheItemInterface Prepends data to a string or an array (unshift)
removeTag($tagName) ExtendedCacheItemInterface Removes a tag
removeTags(array $tagNames) ExtendedCacheItemInterface Removes multiple tags
set($value) ExtendedCacheItemInterface The setter, for those who missed it, can be anything except resources or non-serializer object (ex: PDO objects, file pointers, etc).
setCreationDate($expiration) \DatetimeInterface Sets the creation date for this cache item (as a DateTimeInterface object) *
setEventManager($evtMngr) ExtendedCacheItemInterface Sets the event manager
setExpirationDate() ExtendedCacheItemInterface Alias of expireAt() (for more code logic)
setModificationDate($expiration) \DatetimeInterface Sets the modification date for this cache item (as a DateTimeInterface object) *
setTags(array $tags) ExtendedCacheItemInterface Sets multiple tags

* Require configuration directive "itemDetailedDate" to be enabled, else a \LogicException will be thrown

ItemPool API (ExtendedCacheItemPoolInterface)

Methods (By Alphabetic Order) Return Description
appendItemsByTag($tagName, $data) bool Appends items by a tag
appendItemsByTags(array $tagNames, $data) bool Appends items by one of multiple tag names
attachItem($item) void (Re-)attaches an item to the pool
clear() bool Allows you to completely empty the cache and restart from the beginning
commit() bool Persists any deferred cache items
decrementItemsByTag($tagName, $step = 1) bool Decrements items by a tag
decrementItemsByTags(array $tagNames, $step = 1) bool Decrements items by one of multiple tag names
deleteItem($key) bool Deletes an item
deleteItems(array $keys) bool Deletes one or more items
deleteItemsByTag($tagName) bool Deletes items by a tag
deleteItemsByTags(array $tagNames, int $strategy) bool Deletes items by one of multiple tag names
detachItem($item) void Detaches an item from the pool
getConfig() ConfigurationOption Returns the configuration object
getConfigOption($optionName); mixed Returns a configuration value by its key $optionName
getDefaultConfig() ConfigurationOption Returns the default configuration object (not altered by the object instance)
getDriverName() string Returns the current driver name (without the namespace)
getEventManager() EventManagerInterface Gets the event manager
getHelp() string Provides a very basic help for a specific driver
getInstanceId() string Returns the instance ID
getItem($key) ExtendedCacheItemInterface Retrieves an item and returns an empty item if not found
getItems(array $keys) ExtendedCacheItemInterface[] Retrieves one or more item and returns an array of items. As of v9.2 an internal improvement has been made to this method.
getAllItems(string $pattern = '') ExtendedCacheItemInterface[] (v9.2) Retrieves all cache items with a hard limit of 9999 items. Support limited to some drivers
getItemsAsJsonString(array $keys) string Returns A json string that represents an array of items
getItemsByTag($tagName, $strategy) ExtendedCacheItemInterface[] Returns items by a tag
getItemsByTags(array $tagNames, $strategy) ExtendedCacheItemInterface[] Returns items by one of multiple tag names
getItemsByTagsAsJsonString(array $tagNames, $strategy) string Returns A json string that represents an array of items corresponding
getStats() DriverStatistic Returns the cache statistics as an object, useful for checking disk space used by the cache etc.
hasEventManager() bool Check the event manager
hasItem($key) bool Tests if an item exists
incrementItemsByTag($tagName, $step = 1, $strategy) bool Increments items by a tag
incrementItemsByTags(array $tagNames, $step = 1, $strategy) bool Increments items by one of multiple tag names
isAttached($item) bool Verify if an item is (still) attached
prependItemsByTag($tagName, $data, $strategy) bool Prepends items by a tag
prependItemsByTags(array $tagNames, $data, $strategy) bool Prepends items by one of multiple tag names
save(CacheItemInterface $item) bool Persists a cache item immediately
saveDeferred(CacheItemInterface $item) bool Sets a cache item to be persisted later
saveMultiple(...$items) bool Persists multiple cache items immediately
setEventManager(EventManagerInterface $evtMngr) ExtendedCacheItemPoolInterface Sets the event manager

:new: in V8: Multiple strategies ($strategy) are now supported for tagging:

It also supports multiple calls, Tagging, Setup Folder for caching. Look at our examples folders for more information.

Phpfastcache versioning API

Phpfastcache provides a class that gives you basic information about your Phpfastcache installation

Want to keep it simple ?

:sweat_smile: Good news, as of the V6, a Psr16 adapter is provided to keep the cache simplest using very basic getters/setters:

Basic usage:

Internally, the Psr16 adapter calls the Phpfastcache Api via the cache manager.

Introducing to events

:mega: As of the V6, Phpfastcache provides an event mechanism. You can subscribe to an event by passing a Closure to an active event:

An event callback can get unbind but you MUST provide a name to the callback previously:

:new: As of the V8 you can simply subscribe to every event of Phpfastcache.

More information about the implementation and the events are available on the Wiki

Introducing new helpers

:books: As of the V6, Phpfastcache provides some helpers to make your code easier.

May more will come in the future, feel free to contribute !

Introducing aggregated cluster support

Check out the WIKI to learn how to implement aggregated cache clustering feature.

As Fast To Implement As Opening a Beer

:thumbsup: Step 1: Include phpFastCache in your project with composer:

:construction: Step 2: Setup your website code to implement the phpFastCache calls (with Composer)

:floppy_disk: Legacy support (Without Composer)

* See the file examples/withoutComposer.php for more information.\ :warning: The legacy autoload will be removed in the next major release :warning:\ Please include Phpfastcache through composer by running composer require phpfastcache/phpfastcache.

:zap: Step 3: Enjoy ! Your website is now faster than lightning !

For curious developers, there is a lot of other examples available here.

:boom: Phpfastcache support

Found an issue or have an idea ? Come here and let us know !

All versions of phpfastcache with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
psr/cache Version ^2.0||^3.0
psr/simple-cache Version ^2.0||^3.0
ext-mbstring Version *
ext-json Version *
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 phpfastcache/phpfastcache contains the following files

Loading the files please wait ....