Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laminas Cache Laravel Package

laminas/laminas-cache

Laminas Cache provides flexible caching for PHP applications, with adapters for common backends, cache storage, patterns, plugins, and PSR-compatible integrations. Includes tools for configuring, managing, and testing cache behavior in Laminas apps.

View on GitHub
Deep Wiki
Context7

OutputCache

The OutputCache pattern caches output between calls to start() and end().

Quick Start

use Laminas\Cache\Pattern\OutputCache;
use Laminas\Cache\Pattern\PatternOptions;

$outputCache = new OutputCache(
    $storage,
    new PatternOptions()
);

Storage Adapter

The $storage adapter can be any adapter which implements the StorageInterface. Check out the Pattern Quick Start-Section for a standard adapter which can be used here.

Configuration Options

Option Data Type Default Value Description
storage string|array|Laminas\Cache\Storage\StorageInterface none deprecated Adapter used for reading and writing cached data.

Examples

Caching a View Script

use Laminas\Cache\Pattern\OutputCache;
use Laminas\Cache\Pattern\PatternOptions;

$outputCache = new OutputCache(
    $storage,
    new PatternOptions()
);

$outputCache->start('mySimpleViewScript');
include '/path/to/view/script.phtml';
$outputCache->end();

Available Methods

In addition to the methods defined in PatternInterface and StorageCapableInterface, this implementation defines the following methods.

namespace Laminas\Cache\Pattern;

use Laminas\Cache\Exception;

class OutputCache extends AbstractStorageCapablePattern
{
    /**
     * If there is a cached item with the given key, display its data, and
     * return true. Otherwise, start buffering output until end() is called, or
     * the script ends.
     *
     * [@param](https://github.com/param)  string  $key Key
     * [@throws](https://github.com/throws) Exception\MissingKeyException if key is missing
     * [@return](https://github.com/return) bool
     */
    public function start($key);

    /**
     * Stop buffering output, write buffered data to the cache using the key
     * provided to start(), and display the buffer.
     *
     * [@throws](https://github.com/throws) Exception\RuntimeException if output cache not started or buffering not active
     * [@return](https://github.com/return) bool TRUE on success, FALSE on failure writing to cache
     */
    public function end();
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport