Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Easycache Laravel Package

iprodev/php-easycache

A lightweight, easy-to-use caching library for PHP that simplifies storing and retrieving cached data through a clean API. Ideal for small projects needing straightforward caching without extra complexity, with Composer installation and minimal setup.

View on GitHub
Deep Wiki
Context7

Getting Started

v3.0.2 is a maintenance/patch release: no new public features and no apparent breaking changes. Upgrade normally, then run your cache integration tests.

Start by checking:

  • composer.json for PHP/Laravel version constraints. This release targets PHP 8.1 compatibility via PHPUnit ^10.
  • The README/tests for MultiTierCache::readThrough(), EasyCache, and Lock.
  • src/Laravel for Laravel service-provider/config integration, noting it is excluded from the package’s PHPStan config.
  • Existing tests around lock release and read-through cache behavior.

First practical use case: use MultiTierCache::readThrough() to cache an expensive query/API call, and use Lock around the cache-fill path to prevent cache stampedes.

Implementation Patterns

  • Read-through caching: use MultiTierCache::readThrough() for hot data where you want the package to handle cache misses and repopulation. v3.0.2 fixes comparison type errors here with explicit int casts, so keep return types consistent if you subclass.
  • Laravel wrapper: use the EasyCache wrapper when you want Laravel-friendly access. MultiTierCache is no longer final, so extension/wrapping is supported, but prefer composition unless you need to override behavior.
  • Locking around cache fills: acquire a Lock, re-check the cache, populate it, and release in finally. The v3.0.2 fix makes Lock::release() safe when called more than once, including from __destruct() after manual release.
  • Multi-tier setup: use the fast/local tier for frequent reads and the slower/shared tier for cross-process persistence. Exercise both tiers in tests; do not test only the in-memory path.
  • Laravel integration: bind/configure the cache through the package’s Laravel service provider, and test against the real cache store you use in production. Predis remains optional and is ignored in static analysis.
  • CI setup: align package development with PHPUnit 10.5 schema and PHP 8.1. If your app uses PHPUnit 11, keep that in your app’s test suite rather than relying on the package’s dev dependencies.

Gotchas and Tips

  • Lock lifecycle: double-release is now safe, but still avoid relying on destructors for correctness. Always release locks in finally, and set sensible TTLs so a crashed process cannot hold a lock forever.
  • Extension point: MultiTierCache being non-final is intentional for EasyCache wrapping/extension. If you subclass it, preserve readThrough() return semantics and integer handling.
  • PHP 8.1 constraint: the package downgraded PHPUnit to ^10.0 for PHP 8.1. If your app is on PHP 8.2/8.3, this is still fine, but don’t assume package CI validates PHPUnit 11 behavior.
  • Static analysis coverage: src/Laravel is excluded from PHPStan because it needs Laravel dependencies. Run Laravel-specific tests and static analysis in your application context.
  • Optional dependencies: Predis is ignored by PHPStan. Test Redis/Predis paths explicitly when enabled; a green static-analysis run does not prove optional-store behavior.
  • CI warnings: failOnWarning is disabled in the package’s PHPUnit config to avoid optional-extension warnings failing CI. In your own app CI, consider enabling warnings so real environment issues are not hidden.
  • Debugging lock errors: if you saw the previous TypeError, reproduce with manual release plus destructor release. After upgrading, verify no code depends on the old failure behavior.
  • Config quirks: PHPStan deprecated options were removed/updated. If you copied the package’s old PHPStan config, clean up checkMissingIterableValueType and checkGenericClassInNonGenericObjectType.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package