LaravelPackages.net
Acme Inc.
Toggle sidebar
deniztezcan/laravel-responsecache-additions

Speed up a Laravel application by caching the entire response additions

156
0
v1.0.3
About deniztezcan/laravel-responsecache-additions

deniztezcan/laravel-responsecache-additions is a Laravel package for speed up a laravel application by caching the entire response additions. It currently has 0 GitHub stars and 156 downloads on Packagist (latest version v1.0.3). Install it with composer require deniztezcan/laravel-responsecache-additions. Discover more Laravel packages by deniztezcan or browse all Laravel packages to compare alternatives.

Last updated

Laravel Response Cache additions

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.

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

<?php

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.

Star History Chart