Download the PHP package talleu/php-redis-om without Composer
On this page you can find all versions of the php package talleu/php-redis-om. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download talleu/php-redis-om
More information about talleu/php-redis-om
Files in talleu/php-redis-om
Package php-redis-om
Short Description A PHP object mapper library for Redis
License MIT
Informations about the package php-redis-om
php-redis-om 🗄️
A PHP object mapper for Redis.
An Object Mapper for Redis®, designed to providing an intuitive and familiar interface for PHP developers to interact with Redis.
Features 🛠️
- Doctrine-like methods and architecture
- Symfony bundle integration
- Easy integration with existing PHP applications
- High performance and scalability with Redis®
- Support for Redis JSON module
- Automatic schema generation
- Search and query capabilities
Requirements ⚙️
- PHP 8.2 or higher
- Redis 4.0 or higher
- Redisearch module (available by default with Redis >8) (installation)
- php-redis extension OR Predis library
- Redis JSON module (optional)
- Composer
Supported types ✅
- scalar (string, int, float, bool, double)
- timestamp
- json
- null
- DateTimeImmutable
- DateTime
- array and nested arrays
- object and nested objects
- stdClass
Installation 📝
Install the library via Composer:
Depending on your configuration, use phpredis or Predis
Symfony bundle 🎵
In a Symfony application, you may need to add this line to config/bundles.php
And that's it, your installation is complete ! 🚀
Basic Usage 🎯
Add the RedisOm attribute to your class to map it to a Redis schema:
After add the RedisOm attribute to your class,
you have to run the following command to create the Redis schema for your classes (default path is ./src
):
For Symfony users :
For others PHP applications :
Then you can use the ObjectManager to persist your objects from Redis ! 💪
For Symfony users, just inject the RedisObjectManagerInterface in the constructor :
For others PHP applications :
🥳 Congratulations, your PHP object is now registered in Redis !
You can now retrieve your user wherever you like using the repository provided by the Object Manager (or the object manager directly) :