What Is New in Predis 1
Predis 1.0 marks a major milestone with significant internal refactoring and modernization. This release focuses on improving code quality, maintainability, and compatibility with modern PHP versions while maintaining the same API developers are familiar with.
| Category | Key Changes |
|---|---|
| New Features | Support for Redis 6, new connection classes, dropped PHP 5.x support |
| Improvements | Major codebase refactoring, modern PHP syntax, improved exception handling |
| Bug Fixes | Various fixes from the v0.8.x series |
| Deprecated | Removed support for old PHP versions and HHVM |
What are the major codebase improvements in Predis 1?
The entire codebase underwent significant refactoring to modernize the code and improve maintainability. This involved adopting modern PHP features and cleaning up the internal architecture.
Developers will benefit from a more stable and cleaner codebase, though the public API remains largely unchanged. This refactoring sets the foundation for future development and makes the code easier to contribute to.
Which PHP versions are supported in Predis 1?
Predis 1.0 drops support for PHP 5.x entirely and requires PHP 7.2 or later. This allows the library to leverage modern PHP features and syntax improvements.
Support for HHVM has also been officially dropped. If you're still running older PHP versions, you'll need to stick with Predis v0.8.x or upgrade your PHP environment.
Does Predis 1 support Redis 6 features?
Yes, Predis 1.0 adds support for Redis 6, including the new Redis protocol version and related features. This keeps the client up-to-date with the latest Redis server capabilities.
The update ensures compatibility with newer Redis commands and protocols, making it suitable for deployments using the latest Redis server versions.
What changed with connection classes in this release?
Predis 1.0 introduces new connection class implementations while maintaining backward compatibility with existing code. The connection handling has been improved for better reliability and performance.
Existing connection parameters should continue to work, but the internal implementation has been modernized to handle connections more efficiently.
How does exception handling work in Predis 1?
Exception handling has been improved with more specific exception types and better error messages. This makes debugging connection issues and command failures much easier.
The new exception hierarchy provides more granular control over error handling, allowing developers to catch specific types of Redis-related exceptions in their applications.
FAQ
Is Predis 1.0 backward compatible with my existing code?
Mostly yes - the public API remains compatible, but you must be running PHP 7.2+. Check your PHP version and test thoroughly before upgrading in production.
What happens if I try to use Predis 1.0 with PHP 5.6?
It will not work. Predis 1.0 requires PHP 7.2 or later. You'll need to either upgrade your PHP environment or continue using Predis v0.8.x.
Are there any new dependencies in this release?
No new external dependencies were added. The changes focus on internal refactoring and modernization rather than adding new package requirements.
Should I upgrade from v0.8.x to v1.0 immediately?
If you're on PHP 7.2+ and need Redis 6 support or want the improved codebase, yes. Otherwise, v0.8.x will continue to work for existing applications.
How does this affect connection pooling and clustering?
Connection handling has been improved internally, but the clustering interface remains compatible. You might see better performance and stability in distributed setups.