PHPackages                             pigeonboys/fastsub - 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. pigeonboys/fastsub

ActiveLibrary[Caching](/categories/caching)

pigeonboys/fastsub
==================

A blazing-fast, Redis-powered subscription service for instant, cached access across projects.

v0.9.0(1y ago)22.4k↑14.3%MITPHPPHP ^7.2 || ^8.0

Since Feb 11Pushed 1y agoCompare

[ Source](https://github.com/pigeonboys/fastsub)[ Packagist](https://packagist.org/packages/pigeonboys/fastsub)[ RSS](/packages/pigeonboys-fastsub/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Fastsub
=======

[](#fastsub)

Introduction
------------

[](#introduction)

The Fastsub package leverages Redis hashes to efficiently manage subscriptions. Each identity—such as a serial number, user ID, or other unique identifiers—has a dedicated hash. Subscription data is stored as key-value pairs within these hashes, where the values can be plain strings or JSON-encoded objects. This setup allows for easy tracking of subscription details like products, expiration dates, and more. JSON encoding also supports multiple subscriptions per identity, enabling the management of various services under one unique identifier. Other services can query these identity-specific Redis hashes for real-time access to subscription data.

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

[](#installation)

To install the package, run the following command:

```
$ composer require pigeonboys/fastsub
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

Before calling the `SubscriptionQuery` class for the first time, the `SubscriptionConfiguration` class must be initialized:

```
use PigeonBoys\Fastsub;

Fastsub\SubscriptionConfiguration::initialize(host: '127.0.0.1', port: 6379, database: 0);
```

### Set Subscriptions

[](#set-subscriptions)

You can set the value of a field (key) as a plain string. However, it is recommended to use a JSON-encoded object to store additional subscription details.

```
use PigeonBoys\Fastsub;

// Set key-value pair in the  hash
Fastsub\SubscriptionQuery::hash('serialnumber')->updateOrCreate('111111', '[{"product":"test-product","ends_at":1738774349}]');

// Set multiple key-value pairs in the  hash
Fastsub\SubscriptionQuery::hash('serialnumber')->upsert([
    '111111' => '[{"product":"test-product","ends_at":1738774349}]',
    '222222' => '[{"product":"test-product","ends_at":1738774349}]',
]);
```

### Get Subscriptions from field

[](#get-subscriptions-from-field)

You can retrieve the plain string value of a field (key) using the `get` method. Each field corresponds to an array index.

```
use PigeonBoys\Fastsub;

// Retrieve the field '111111' from the 'serialnumber' hash
$s = Fastsub\SubscriptionQuery::hash('serialnumber')->field('111111')->get();

// Response:
array:1 [▼
  111111 => "[{"product":"test-product","ends_at":1738774349}]"
]
```

To retrieve the field as an array (assuming it was stored as a JSON-encoded string), use the `json` method:

```
use PigeonBoys\Fastsub;

// Retrieve the field '111111' from the 'serialnumber' hash as a JSON object
$s = Fastsub\SubscriptionQuery::hash('serialnumber')->field('111111')->json();

// Response:
array:1 [▼
  111111 => array:1 [▼
    0 => array:2 [▼
      "product" => "test-product"
      "ends_at" => 1738774349
    ]
  ]
]
```

### Get Subscriptions from Multiple Fields

[](#get-subscriptions-from-multiple-fields)

To retrieve the plain string values of multiple fields (keys), use the `get` method with an array of field names.

```
use PigeonBoys\Fastsub;

// Retrieve fields '111111' and '222222' from the 'serialnumber' hash
$s = Fastsub\SubscriptionQuery::hash('serialnumber')->fields(['111111', '222222'])->get();

// Response:
array:2 [▼
  111111 => "[{"product":"test-product","ends_at":1738774349}]"
  222222 => "[{"product":"test-product","ends_at":1738774349}]"
]
```

Similarly, to retrieve the fields as JSON-encoded arrays, use the `json` method:

```
use PigeonBoys\Fastsub;

// Retrieve fields '111111' and '222222' from the 'serialnumber' hash as JSON objects
$s = Fastsub\SubscriptionQuery::hash('serialnumber')->fields(['111111', '222222'])->json();

// Response:
array:2 [▼
  111111 => array:1 [▼
    0 => array:2 [▼
      "product" => "test-product"
      "ends_at" => 1738774349
    ]
  ]
  222222 => array:2 [▼
    0 => array:2 [▼
      "product" => "test-product"
      "ends_at" => 1738774349
    ]
  ]
]
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance42

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

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

462d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9717457d8c22f77abd366048d290b3b63eec1258ee971817c456f7fc06123f06?d=identicon)[nicestdev](/maintainers/nicestdev)

---

Top Contributors

[![nicestdev](https://avatars.githubusercontent.com/u/66088868?v=4)](https://github.com/nicestdev "nicestdev (1 commits)")

### Embed Badge

![Health badge](/badges/pigeonboys-fastsub/health.svg)

```
[![Health](https://phpackages.com/badges/pigeonboys-fastsub/health.svg)](https://phpackages.com/packages/pigeonboys-fastsub)
```

###  Alternatives

[rhubarbgroup/redis-cache

A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.

51795.3k1](/packages/rhubarbgroup-redis-cache)[monospice/laravel-redis-sentinel-drivers

Redis Sentinel integration for Laravel and Lumen.

103830.5k](/packages/monospice-laravel-redis-sentinel-drivers)[jamescauwelier/psredis

Sentinel client for the popular php redis client

77392.9k5](/packages/jamescauwelier-psredis)[cache/predis-adapter

A PSR-6 cache implementation using Redis (Predis). This implementation supports tags

272.6M13](/packages/cache-predis-adapter)[symfony-bundles/redis-bundle

Symfony Redis Bundle

271.1M5](/packages/symfony-bundles-redis-bundle)[pdffiller/qless-php

PHP Bindings for qless

29113.2k1](/packages/pdffiller-qless-php)

PHPackages © 2026

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