PHPackages                             fr3on/laravel-sage - 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. fr3on/laravel-sage

ActiveLibrary[Caching](/categories/caching)

fr3on/laravel-sage
==================

A drop-in semantic cache for the Laravel AI SDK.

0.0.1(3mo ago)22321MITPHPPHP ^8.3CI passing

Since Apr 10Pushed 3mo agoCompare

[ Source](https://github.com/fr3on/laravel-sage)[ Packagist](https://packagist.org/packages/fr3on/laravel-sage)[ RSS](/packages/fr3on-laravel-sage/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Laravel Sage
============

[](#laravel-sage)

[![Latest Version on Packagist](https://camo.githubusercontent.com/97e178109a7d0fec29174e8363ac0ef3990e4ca9b6536eebfa9c6fc3a861ec52/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6672336f6e2f6c61726176656c2d736167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fr3on/laravel-sage)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ed7f527001b276e9698f0f4ecbb3612c79552e95eaaec9313fc4c7988081f4f9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6672336f6e2f6c61726176656c2d736167652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/fr3on/laravel-sage/actions/workflows/ci.yml)[![Total Downloads](https://camo.githubusercontent.com/fb5f7ce75630db7b37c59eccf1f2989320f6e84de161a45ba2a73b61f28c26ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6672336f6e2f6c61726176656c2d736167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fr3on/laravel-sage)[![PHP Version Support](https://camo.githubusercontent.com/f087ac8c9feabb23bd5d25a9ea0af1ccafc93fda3c3fb4768cd0ae419e7fc6f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e332d3838393262662e7376673f7374796c653d666c61742d737175617265)](https://www.php.net/)[![Laravel Version Support](https://camo.githubusercontent.com/1879b74168398f49a95f61fa885b3ad035f35a78f5a31c98e2a7960ce0667b3c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531312d6666326432302e7376673f7374796c653d666c61742d737175617265)](https://laravel.com/)[![License](https://camo.githubusercontent.com/8fec7cbd47ac95cc6b41d9ce9e0db953994acc5702f4cd68afcc7b315efbd771/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6672336f6e2f6c61726176656c2d736167652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A drop-in semantic cache for the Laravel AI SDK — serve cached LLM responses for meaning-similar prompts, not just exact matches.

Sage matched prompts by *meaning* using vector embeddings. "How do I reset my password?" and "I forgot my login, how to change it?" return the same cached response — instantly, at zero API cost.

Features
--------

[](#features)

- **Semantic Matching**: Matches on intent, not just string equality.
- **Zero Infra Latency**: Works with your existing Postgres (pgvector) or Redis database.
- **One-Line Integration**: Hooks natively into Laravel AI SDK agent middleware.
- **Automatic Token Savings**: Significant reduction in LLM API costs.
- **Pulse Integration**: Includes a built-in Pulse card to track hit rates and cost savings.

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

[](#installation)

You can install the package via composer:

```
composer require fr3on/laravel-sage
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="sage-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="sage-config"
```

Usage
-----

[](#usage)

Sage hooks into the Laravel AI SDK's native agent middleware system. Add `SemanticCache` to your agent's middleware stack:

```
use Fr3on\Sage\Middleware\SemanticCache;

class SupportAgent implements Agent, HasMiddleware
{
    public function middleware(): array
    {
        return [
            new SemanticCache(threshold: 0.92, ttl: 86400),
        ];
    }
}
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance80

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

106d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/205356416?v=4)[fr3onv](/maintainers/fr3onv)[@fr3onv](https://github.com/fr3onv)

---

Top Contributors

[![fr3on](https://avatars.githubusercontent.com/u/26393383?v=4)](https://github.com/fr3on "fr3on (7 commits)")

---

Tags

aicachelaravelphpsemanticvectorlaravelaicachevectorsemantic

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/fr3on-laravel-sage/health.svg)

```
[![Health](https://phpackages.com/badges/fr3on-laravel-sage/health.svg)](https://phpackages.com/packages/fr3on-laravel-sage)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M246](/packages/laravel-ai)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k96.5k1](/packages/mike-bronner-laravel-model-caching)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
