PHPackages                             titzu/cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. titzu/cache

ActiveLibrary[Caching](/categories/caching)

titzu/cache
===========

Laravel 4 Route Caching

111153PHP

Since Nov 4Pushed 12y ago4 watchersCompare

[ Source](https://github.com/titzu/Laravel-4-Route-Cache)[ Packagist](https://packagist.org/packages/titzu/cache)[ RSS](/packages/titzu-cache/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

This is a Laravel 4 package that provides caching for the response of the application.

Installation
------------

[](#installation)

Begin by installing this package through Composer. Edit your project's `composer.json` file to require `titzu/cache`.

```
"require": {
        "laravel/framework": "4.0.*",
        "titzu/cache": "dev-master"
},
"require-dev": {
        "phpunit/phpunit": "3.7.*",
        "mockery/mockery": "dev-master@dev"
},
"minimum-stability" : "dev"

```

Next, update Composer from the Terminal:

```
composer update

```

Once this operation completes, the final step is to add the service provider. Open `app/config/app.php`, and add a new item to the providers array.

```
'Titzu\RouterCache\RouterCacheServiceProvider'

```

That's all!

### Usage

[](#usage)

Register route for caching
--------------------------

[](#register-route-for-caching)

You must register the filter with the route

```
Route::get('/', array('before' => 'cache_get', 'after' => 'cache_set', 'uses' => 'HomeController@show'));
```

Of course you can also register a group of routes

```
Route::group(array('before' => 'cache_get', 'after' => 'cache_set'), function()
{
    Route::get('/', 'HomeController@show');
    Route::get('another', 'AnotherController@show');
});
```

Clear Routes Cache
------------------

[](#clear-routes-cache)

```
php artisan router:clear

```

By default Laravel uses file cache driver for cache storage. Because cache sections are not supported when using the file or database cache drivers and in order not to flush all cache when we need to refresh just the routes cache I keep cached routes in a separate cache entry 'cached\_routes'. The router:clear command will then only operate on the keys registered in cached\_routes array.

Note
----

[](#note)

In order to verify that the request is served from the cache or on the fly, I added a new header entry

```
$response->header('Served-From', 'cache');
```

and

```
$response->header('Served-From', 'laravel');
```

You can then find this using entry developer tools ( firebug for example ).

Contact
-------

[](#contact)

Feel free to use, fork, whatever :)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1998760?v=4)[Catalin Titu](/maintainers/titzu)[@titzu](https://github.com/titzu)

---

Top Contributors

[![titzu](https://avatars.githubusercontent.com/u/1998760?v=4)](https://github.com/titzu "titzu (3 commits)")

### Embed Badge

![Health badge](/badges/titzu-cache/health.svg)

```
[![Health](https://phpackages.com/badges/titzu-cache/health.svg)](https://phpackages.com/packages/titzu-cache)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
