This project isn't really an adapter, for me, it is a sort of GATEWAY. (see Martin Fowler, Gateway Pattern).
The goal here is to adapt use of either Predis client or native PHP Redis client in a transparently way.
Those are the real adaptees, their respective classes are extended to adapt them to the gateway (RedisAdapter)
that will encapsulate one of them (as a redis client) and use one or the other indifferently depending on environment.
It will use preferably PHP Redis if available (extension installed), or else fallback on predis.
This class settles base for other projects based on it (PSR-6 and PSR-16 Cache systems and so on)
composer require llegaz/redis-adapter
composer installIn order to work we need php8 and some classical php extensions plus a local redis server (for testing purpose) and docker to test multiples instances of redis servers.
apt install php8.1 php8.1-cli php8.1-common php8.1-mbstring php8.1-opcacheand perhaps other packages may be required for composer to work smoothly
apt install php8.1-xml php8.1-http php8.1-dominstall redis servers with docker (you will need a valid docker and docker-compose on your system)
docker pull redis
docker-compose -f docker-compose.yml up -dYou're welcome to propose things. I am open to criticism as long as it remains benevolent.
Stay tuned, by following me on github, for new features using predis and PHP Redis.
