PHPackages                             chalcedonyt/laravel-redis-tagger - 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. chalcedonyt/laravel-redis-tagger

ActiveLibrary[Caching](/categories/caching)

chalcedonyt/laravel-redis-tagger
================================

A Helper function for Redis in Laravel to organize tags.

0.4(10y ago)71.2k1[1 PRs](https://github.com/chalcedonyt/laravel-redis-tagger/pulls)MITPHPPHP &gt;=5.3.0

Since Oct 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/chalcedonyt/laravel-redis-tagger)[ Packagist](https://packagist.org/packages/chalcedonyt/laravel-redis-tagger)[ Docs](https://github.com/chalcedonyt/laravel-redis-tagger)[ RSS](/packages/chalcedonyt-laravel-redis-tagger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

chalcedonyt/laravel-redis-tagger
================================

[](#chalcedonytlaravel-redis-tagger)

A helper Facade and functions to organize Redis tags, enabling easy type-hinting, built-in parameter validation, and placeholder replacement.

Install
-------

[](#install)

Via Composer (minimum stability must be set to dev)

```
$ composer require chalcedonyt/laravel-redis-tagger
```

Include the Provider and Facade into app.php.

```
Chalcedonyt\RedisTagger\Providers\RedisTaggerServiceProvider::class
```

```
'RedisTagger' => Chalcedonyt\RedisTagger\Facades\RedisTagger::class
```

Usage - GET/SET
---------------

[](#usage---getset)

```
php artisan redis_tagger:make UserPosts\\PostCount
```

The only thing you need to set is the `tags` value. You may insert either a plain string, a {tagtemplate}, or a {tagtemplate} with a \\Closure that returns a value. (This allows type-hinting).

Any {tagtemplate} keys must be defined when called.

```
class PostCount extends Tagger
{
    public function __construct(){
        parent::__construct();
        $this -> tags = [
            'user_posts',
            '{type}',
            '{post_id}' => function( Post $post ){
                return $post -> id;
            },
            'count'
        ];
    }
}
```

For key-value operations, you may then call ::set or ::get on the `RedisTagger` Facade:

```
$post = new Post();
$post -> id = 123
$args = ['type' => 'article', 'post_id' => $post ];
RedisTagger::set('UserPosts\\PostCount', $args, 1000); //sets the key "user_posts:article:123:count" to 1000.
```

Likewise, you can retrieve the value with

```
RedisTagger::get('UserPosts\\PostCount', $args);
```

You may return only a key (e.g. for use with sets)

```
RedisTagger::getKey('UserPosts\\PostCount', $args); //returns "user_posts:article:123:count"
```

It is also possible to extend any taggers you create by adding to the parent's $tags variable.

```
class PostCountToday extends PostCount
{
    public function __construct(){
        parent::__construct();
        $this -> tags[]= 'today';
    }
}
```

```
class PostCountYesterday extends PostCount
{
    public function __construct(){
        parent::__construct();
        $this -> tags[]= 'yesterday';
    }
}
```

```
RedisTagger::set('UserPosts\PostCountToday', $args, 1000); //sets the key "user_posts:article:123:count:today" to 1000.
RedisTagger::set('UserPosts\PostCountYesterday', $args, 1000); //sets the key "user_posts:article:123:count:yesterday" to 1000.

```

Usage - KEYS
------------

[](#usage---keys)

RedisTagger also wraps the `::keys` function of Redis. When calling `keys`, no validation is done on the arguments. Any missing {tagtemplates} will be cast to `*`:

```
$args = ['type' => 'a??'];
RedisTagger::keys('UserPosts\\PostCount', $args); //returns "user_posts:a??:*:count"
```

Usage - Extracting tag values
-----------------------------

[](#usage---extracting-tag-values)

You may extract the value of a {tag} from a key by using the ::valueOfTagInKey function.

```
$key = "user_posts:article:123:count:yesterday";

RedisTagger::valueOfTagInKey('UserPosts\\PostCount', $key, 'post_id'); //returns "123"
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

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

3863d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ff150ccb744dbada2b6373b324071abc871ba07fc3334ece55860c35d36d124?d=identicon)[chalcedonyt](/maintainers/chalcedonyt)

---

Top Contributors

[![timothythteoh](https://avatars.githubusercontent.com/u/7899530?v=4)](https://github.com/timothythteoh "timothythteoh (7 commits)")[![chalcedonyt](https://avatars.githubusercontent.com/u/3726096?v=4)](https://github.com/chalcedonyt "chalcedonyt (1 commits)")

---

Tags

laravelredistagging

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chalcedonyt-laravel-redis-tagger/health.svg)

```
[![Health](https://phpackages.com/badges/chalcedonyt-laravel-redis-tagger/health.svg)](https://phpackages.com/packages/chalcedonyt-laravel-redis-tagger)
```

###  Alternatives

[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[monospice/laravel-redis-sentinel-drivers

Redis Sentinel integration for Laravel and Lumen.

103830.5k](/packages/monospice-laravel-redis-sentinel-drivers)[encore/redis-manager

Redis manager for laravel

25243.1k](/packages/encore-redis-manager)[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)[yangusik/laravel-balanced-queue

Laravel queue management with load balancing between partitions (user groups)

786.4k](/packages/yangusik-laravel-balanced-queue)[ginnerpeace/laravel-redis-lock

Simple redis distributed locks for Laravel.

15114.4k](/packages/ginnerpeace-laravel-redis-lock)

PHPackages © 2026

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