Speed up a Laravel application by caching the entire response additions

v1.0.3 2022-01-11 08:41 UTC

This package is auto-updated.

Last update: 2022-05-11 09:22:14 UTC


Latest Version on Packagist MIT Licensed Total Downloads

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


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,


'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' => [

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

'replacers' => [

The FooReplacer can consists of the following


namespace App\Replacers;

use DenizTezcan\ResponseCache\Replacers\BladeFilesReplacer;

class FooReplacer extends BladeFilesReplacer
	protected string | array $htmlTag = 'fake-html-tag'; // html tag without the <> in string or array format
    protected string | array $realTimeView = 'partials.fake-blade-loc'; // blade path string or array format

this will replace the content of the with the on load view renderings of the file partials.fake-blade-loc.