beste/in-memory-cache
PSR-6 compliant in-memory cache for PHP—ideal as a lightweight default cache and for fast, predictable tests. Supports standard CacheItemPoolInterface behavior and optional PSR-20 clocks (e.g., frozen clocks) for time-based expiry testing.
Architecture fit: Excellent for Laravel's PSR-6 compliant cache system. Laravel natively supports PSR-6 interfaces, enabling seamless integration as a custom driver without adapter layers. The package's simplicity aligns with Laravel's modular cache architecture where drivers can be swapped via configuration.
Integration feasibility: High. Requires minimal effort to create a Laravel cache driver that wraps InMemoryCache. Composer dependency management handles all required PSR packages, and no additional configuration beyond driver registration is needed.
Technical risk: Low for intended use cases (tests/fallback), but critical if misapplied to production environments. Key risks include accidental production deployment due to misconfiguration, lack of persistence, and no cross-process sharing.
Key questions:
Stack fit: Fits perfectly within Laravel's cache driver architecture. Can be implemented as a custom driver (e.g., 'in_memory') using PSR-6 compliance, requiring no additional dependencies beyond the package itself.
Migration path:
composer require beste/in-memory-cache).Illuminate\Contracts\Cache\Repository by delegating to InMemoryCache.config/cache.php under 'stores'..env for local/testing environments. No application logic changes needed.Compatibility: Fully compatible with Laravel's cache system due to PSR-6 adherence. Works with all Laravel versions supporting PSR-6 (Laravel 5.7+). No conflicts with existing cache drivers.
Sequencing:
Maintenance: Minimal overhead. The package is stable with clear versioning and no active dependency management issues. Maintenance mainly involves monitoring for Laravel updates that might affect cache drivers, but since it's a simple wrapper, this is rare.
Support: Limited community support due to low dependents (0), but the package is small and well-documented. Internal engineering team can handle troubleshooting. Critical to document usage guidelines to prevent misconfiguration.
Scaling: Not applicable for production scaling. In test environments, memory usage scales linearly with cache items. For large test suites, recommend periodic cache clearing or clear() in test teardown to prevent memory bloat.
Failure modes:
Ramp-up: Very low. Engineers can start using it immediately after installation. Documentation is clear with usage examples. Training required only to emphasize "do not use in production" and proper test isolation practices.
How can I help you explore Laravel packages today?