PHPackages                             deniztezcan/laravel-responsecache-additions - 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. deniztezcan/laravel-responsecache-additions

ActiveLibrary[Caching](/categories/caching)

deniztezcan/laravel-responsecache-additions
===========================================

Speed up a Laravel application by caching the entire response additions

v1.0.3(4y ago)0156MITPHPPHP ^8.0

Since Nov 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/deniztezcan/laravel-responsecache-additions)[ Packagist](https://packagist.org/packages/deniztezcan/laravel-responsecache-additions)[ Docs](https://github.com/deniztezcan/laravel-responsecache-additions)[ RSS](/packages/deniztezcan-laravel-responsecache-additions/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Laravel Response Cache additions
================================

[](#laravel-response-cache-additions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e8c5a2a24d4557d18ab3c6e43b9c2b33a57decd25c3b4a403e16f9e5f1717d6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64656e697a74657a63616e2f6c61726176656c2d726573706f6e736563616368652d6164646974696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/deniztezcan/laravel-responsecache-additions)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/6d0d2d2fd785dd256f4062767b4e6091622c346463cd42b70ce1139d7b931a07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64656e697a74657a63616e2f6c61726176656c2d726573706f6e736563616368652d6164646974696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/deniztezcan/laravel-responsecache-additions)

Additions to Spatie's speed up a Laravel app by caching the entire response package so that Mobile and Desktop visitors view different websites.

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

[](#installation)

You can install the package via composer:

```
composer require deniztezcan/laravel-responsecache-additions
```

The package will automatically register itself.

You can publish the config file with:

```
php artisan vendor:publish --provider="Spatie\ResponseCache\ResponseCacheServiceProvider"
```

Replace the following line

```
'hasher' => \Spatie\ResponseCache\Hasher\DefaultHasher::class,
```

with

```
'hasher' => \DenizTezcan\ResponseCache\Hasher\MobileHasher::class,
```

This will make sure Mobile and Desktop visitors view different websites. If you want to make sure a specific area of the website get's replaced by a live version please change:

```
'replacers' => [
    \Spatie\ResponseCache\Replacers\CsrfTokenReplacer::class,
],
```

with your own replacer, for instance located in `App\Replacers\FooReplacer`

```
'replacers' => [
    \Spatie\ResponseCache\Replacers\CsrfTokenReplacer::class,
    \App\Replacers\FooReplacer::class,
],
```

The `FooReplacer` can consists of the following

```
