nocs/laravel-retriever

Retrieve cached data made simple.
2,398 1
Install
composer require nocs/laravel-retriever
Latest Version:v1.1.12
PHP:^7.3 || ^8.0
License:MIT
Last Updated:Aug 11, 2026
Links: GitHub  ·  Packagist
Maintainer: nineoclocksomewhere

Laravel Retriever

Latest Version on Packagist Total Downloads

Laravel Retriever resolves small PHP classes and methods by a string key, then memoizes their return values through Laravel's cache manager. It is useful for reusable, cacheable data providers such as lookup lists, external-data snapshots, and application-level reference data.

Install

composer require nocs/laravel-retriever

Laravel package discovery registers Nocs\\Retriever\\Providers\\RetrieverServiceProvider automatically. The provider binds the retriever manager and scans app/Retrievers and app/Cache during application boot.

Quick example

Create app/Cache/Colors.php:

<?php

namespace App\Cache;

class Colors
{
    public function red(): string
    {
        return 'red';
    }
}

Retrieve it from application code:

$value = retriever()->get('colors.red');
// or: $value = retriever('colors.red');

The class name and method segment are normalized with Laravel's Str::snake/Str::camel conventions. A class with only a get() method can be addressed as retriever('colors').

Documentation

Development

composer validate --strict
composer test

See Testing and verification for the CI matrix and source-level checks.

Support and license

Report security issues privately to the maintainer rather than through the public issue tracker. This package is released under the MIT license.

Related Packages

barryvdh/laravel-httpcache

HttpCache for Laravel

410,602 501
ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

414,522 85
maartenstaa/laravel-41-route-caching

This package allows you to cache your routes definitions, thereby speeding up ea...

386,174 25
spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

9,823,775 2,814
ytake/laravel-couchbase

Couchbase providers for Laravel

52,494 30