PHPackages                             fyennyi/async-cache-bridge-laravel - 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. fyennyi/async-cache-bridge-laravel

ActiveLibrary[Caching](/categories/caching)

fyennyi/async-cache-bridge-laravel
==================================

Laravel bridge for Fyennyi AsyncCache.

v1.0.0(3mo ago)00LicenseRef-CSSM-Unlimited-2.0PHPPHP ^8.1CI passing

Since Jan 30Pushed 2mo agoCompare

[ Source](https://github.com/Fyennyi/async-cache-bridge-laravel)[ Packagist](https://packagist.org/packages/fyennyi/async-cache-bridge-laravel)[ Fund](https://opencollective.com/cssm)[ Patreon](https://www.patreon.com/ChernegaSergiy)[ RSS](/packages/fyennyi-async-cache-bridge-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

Async Cache Laravel Bridge
==========================

[](#async-cache-laravel-bridge)

[![Latest Stable Version](https://camo.githubusercontent.com/d48d4a2cdd19f734deaed54314424090f20a55cd9b6fd314cfedbc095736d2a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6679656e6e79692f6173796e632d63616368652d6272696467652d6c61726176656c2e7376673f6c6162656c3d5061636b6167697374266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/async-cache-bridge-laravel)[![Total Downloads](https://camo.githubusercontent.com/cd8bba4ebb5f084f8af6168cc1b9df3111c05db7f5ad4ba0bcb59b11a2a35355/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6679656e6e79692f6173796e632d63616368652d6272696467652d6c61726176656c2e7376673f6c6162656c3d446f776e6c6f616473266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/async-cache-bridge-laravel)[![License](https://camo.githubusercontent.com/6fab47dac5c106bbd917c25fd4ace035af12bae4bd7c14b1f3cf8f3658f3c3bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6679656e6e79692f6173796e632d63616368652d6272696467652d6c61726176656c2e7376673f6c6162656c3d4c6963656e6365266c6f676f3d6f70656e2d736f757263652d696e6974696174697665)](https://packagist.org/packages/fyennyi/async-cache-bridge-laravel)[![Tests](https://camo.githubusercontent.com/74ac2be273e1cb2d347663a6f536faccdb8e5f712aa40c0041ef803487dce4e9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4679656e6e79692f6173796e632d63616368652d6272696467652d6c61726176656c2f706870756e69742e796d6c3f6c6162656c3d5465737473266c6f676f3d676974687562)](https://github.com/Fyennyi/async-cache-bridge-laravel/actions/workflows/phpunit.yml)[![Test Coverage](https://camo.githubusercontent.com/48a702f0c6f97d9fe020eba1dc4ac9bb9b39e709c9e5eda73a09da15110bb304/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f4679656e6e79692f6173796e632d63616368652d6272696467652d6c61726176656c3f6c6162656c3d54657374253230436f766572616765266c6f676f3d636f6465636f76)](https://app.codecov.io/gh/Fyennyi/async-cache-bridge-laravel)[![Static Analysis](https://camo.githubusercontent.com/438f2bbed6d2d664493ec4400ddf3b165eb5830b2bb0e9d361b477343a0b2d87/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4679656e6e79692f6173796e632d63616368652d6272696467652d6c61726176656c2f7068707374616e2e796d6c3f6c6162656c3d5048505374616e266c6f676f3d676974687562)](https://github.com/Fyennyi/async-cache-bridge-laravel/actions/workflows/phpstan.yml)

This is a **Laravel Bridge** for the [Async Cache PHP](https://github.com/Fyennyi/async-cache-php) library. It integrates the asynchronous caching manager directly into your Laravel application, utilizing the standard Laravel Cache and Log components.

Features
--------

[](#features)

- **Automatic Discovery**: Uses Laravel Package Discovery to register the service provider.
- **Seamless Integration**: Automatically injects:
    - `cache.store` (Your default Laravel cache repository, which implements PSR-16).
    - `log` (Laravel Log Manager).
- **Configuration Friendly**: Allows defining global strategies via standard Laravel configuration files.

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

[](#installation)

Run the following command in your terminal:

```
composer require fyennyi/async-cache-bridge-laravel
```

Configuration
-------------

[](#configuration)

To customize the configuration, publish the config file using the `vendor:publish` command:

```
php artisan vendor:publish --tag=async-cache-config
```

This will create a `config/async-cache.php` file where you can set the default strategy and adapter.

```
// config/async-cache.php
return [
    'default_strategy' => 'strict', // strict, background, etc.
    'adapter' => 'cache.store',     // The service ID for the cache driver
];
```

Usage
-----

[](#usage)

### Injecting the Manager

[](#injecting-the-manager)

The bridge registers the `Fyennyi\AsyncCache\AsyncCacheManager` class as a singleton. You can use dependency injection to access it in your Controllers, Jobs, or Services.

```
namespace App\Http\Controllers;

use Fyennyi\AsyncCache\AsyncCacheManager;
use Fyennyi\AsyncCache\CacheOptions;
use Illuminate\Http\Request;

class WeatherController extends Controller
{
    public function __construct(
        private AsyncCacheManager $cache
    ) {}

    public function index(string $city)
    {
        $promise = $this->cache->wrap(
            'weather_' . $city,
            fn() => $this->fetchFromApi($city),
            new CacheOptions(ttl: 300)
        );

        // Note: In a standard Laravel FPM request, you might need to wait for the promise.
        // In Swoole/Octane environments, you can handle it asynchronously.

        // Example for sync retrieval:
        return \React\Async\await($promise);
    }

    private function fetchFromApi(string $city) { /* ... */ }
}
```

Contributing
------------

[](#contributing)

Contributions are welcome and appreciated! Here's how you can contribute:

1. Fork the project
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

Please make sure to update tests as appropriate and adhere to the existing coding style.

License
-------

[](#license)

This library is licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2). See the [LICENSE](LICENSE) file for details.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance84

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.9% 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

103d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2471bdadcf4a5ea969fe763a72d03fb46525b59a7e4cedc3ed4d855029e7785?d=identicon)[ChernegaSergiy](/maintainers/ChernegaSergiy)

---

Top Contributors

[![ChernegaSergiy](https://avatars.githubusercontent.com/u/60980650?v=4)](https://github.com/ChernegaSergiy "ChernegaSergiy (31 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

asyncbridgecachinglaravellaravel-packageperformancephpphp8psr-16service-provider

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fyennyi-async-cache-bridge-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/fyennyi-async-cache-bridge-laravel/health.svg)](https://phpackages.com/packages/fyennyi-async-cache-bridge-laravel)
```

###  Alternatives

[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[laragear/cache-query

Remember your query results using only one method. Yes, only one.

272122.8k](/packages/laragear-cache-query)[namoshek/laravel-redis-sentinel

An extension of Laravels Redis driver which supports connecting to a Redis master through Redis Sentinel.

38679.0k](/packages/namoshek-laravel-redis-sentinel)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

2057.2k](/packages/iazaran-smart-cache)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[ryangjchandler/blade-cache-directive

Cache chunks of your Blade markup with ease.

202200.8k2](/packages/ryangjchandler-blade-cache-directive)

PHPackages © 2026

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