Download the PHP package uxmansarwar/cache without Composer
On this page you can find all versions of the php package uxmansarwar/cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cache
๐งฐ Laravel-Like Cache Wrapper for Core PHP
A fully-featured Laravel-style Cache Wrapper built in Core PHP using the power of Symfony's Cache component. This package provides an elegant and fluent caching API that mirrors Laravel's Cache
facade, making it easy for developers to manage caching in procedural or object-oriented PHP applications outside of Laravel.
๐ Why This Package?
Laravel provides a very expressive and flexible API for caching, but it's deeply coupled with the Laravel framework. This package allows you to bring that elegant Laravel cache experience into any Core PHP project without requiring Laravel at all.
Built for:
- Developers transitioning from Laravel to raw PHP
- Lightweight or micro PHP apps that need efficient caching
- Custom frameworks and standalone apps
๐ง Why a Wrapper?
Wrapping an existing library like Symfony's Cache component helps abstract complexity and create a clean, readable, Laravel-style API without reinventing the wheel. Symfony's cache is PSR-6/16 compliant and battle-tested in production, making it an excellent backend for this wrapper.
โ๏ธ Requirements
- PHP 8.0 or later
- Composer
- Symfony Cache Component
Install Symfony Cache:
๐ฆ Installation
1. Clone or Require
If you're using Composer for your project:
If you're manually integrating:
Place src/Cache.php
in your preferred directory and include it with Composer autoload.
๐งช Initialization
Before using the cache, initialize it:
๐ Full API Usage Examples
๐ Get Value from Cache
๐ Put Value into Cache
โพ๏ธ Store Permanently
โ Check if Key Exists
โ Forget a Cache Key
๐งน Flush Entire Cache
๐ฆ Remember (Lazy Load + Cache)
๐ฆ Remember Forever
๐งช Pull and Delete
๐ชฎ Add if Not Exists
๐พ๏ธ Increment a Value
๐พ Decrement a Value
๐งฑ Tests & Development Setup
Install Dev Dependencies
PestPHP Setup
This will create the tests/
directory and Pest.php
bootstrap file.
PHPStan Setup
Create phpstan.neon
:
Add Test Scripts to composer.json
๐ Example Pest Tests
File: tests/CacheTest.php
๐งฑ Directory Structure
๐ฏ Planned Features
- File-based tagging (like Laravel's tagged cache)
- Redis/Memcached drivers
- PSR-16 compatibility layer
- Cache events and logging
๐งโ๐ป Contribution
Pull requests and issues are welcome! Feel free to fork and improve. Please make sure to write tests and maintain existing code style.
๐ License
This project is open-sourced under the MIT License.
โค๏ธ Credits
This wrapper is built using the power of Symfony Cache and inspired by Laravel's elegant Cache
facade.
๐ Support
If this package helped you, consider โญ starring the repo and sharing it with your fellow PHP developers!