1. Go to this page and download the library: Download kai-init/laravel-normcache library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kai-init / laravel-normcache example snippets
use NormCache\Traits\Cacheable;
class Post extends Model
{
use Cacheable;
}
Author::whereHas('posts', fn($q) => $q->where('published', true))
->dependsOn([Post::class])
->get();
// Works for any query shape — JOIN, GROUP BY, DISTINCT, subquery WHERE, raw ORDER BY:
Author::join('posts', 'posts.author_id', '=', 'authors.id')->dependsOn([Post::class])->get();
Post::select('author_id', DB::raw('SUM(views) as total'))
->groupBy('author_id')->dependsOn([Post::class])->get();