Download the PHP package pigeonboys/fastsub without Composer
On this page you can find all versions of the php package pigeonboys/fastsub. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pigeonboys/fastsub
More information about pigeonboys/fastsub
Files in pigeonboys/fastsub
Package fastsub
Short Description A blazing-fast, Redis-powered subscription service for instant, cached access across projects.
License MIT
Informations about the package fastsub
Fastsub
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
To install the package, run the following command:
Usage
Configuration
Before calling the SubscriptionQuery
class for the first time, the SubscriptionConfiguration
class must be initialized:
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.
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.
To retrieve the field as an array (assuming it was stored as a JSON-encoded string), use the json
method:
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.
Similarly, to retrieve the fields as JSON-encoded arrays, use the json
method: