Download the PHP package eribloo/laravel-cache-objects without Composer

On this page you can find all versions of the php package eribloo/laravel-cache-objects. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cache-objects

Strongly typed cache objects

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Introducing Laravel package that simplifies cache management by allowing you to encapsulate all details in one place. Improve your application cache maintanance with less raw strings and static typing.

You can later use this object to interract with cache:

Table of contents

Installation

You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

Usage

Creating

You can create basic Cache Object by running Artisan Command:

this will create class implementing EriBloo\CacheObjects\Contracts\CacheObject in namespace specified in config with some defaults for you to configure.

CacheObject

EriBloo\CacheObjects\Contracts\CacheObject interface requires you to implement 3 methods:

Key

Key interface is a wrapper for Stringable interface responsible for preparing key for storage. Currently 2 options exist.

StringKey

Basic key that accepts string.

HashedKey

Decorator for other keys that returns hashes key before storage. Accepts optional algorithm in constructor (sha256 by default).

Time-to-live

Defined with Carbon\CarbonInterval. Values that resolve to 0 or less seconds are considered to be stored forever.

Transformer

Transformers are classes responsible for modifying values before storage and after retrieval.

JsonTransformer

Uses json_encode on save and json_decode on load. Accepts optional flags and depth in constructor.

SerializeTransformer

Transformer that uses PHP serialize on save and unserialize on load. Accepts optional class-string[]|bool in constructor to specify classes allowed for deserialization.

EncryptedTransformer

Decorator for other transformer that uses Crypt::encryptString on save and Crypt::decryptString on load.

GuardTransformer

Proxy for other transformer that doesn't modify values, but instead validates them before storage or after retrieval. This class accepts up to 2 closures that should throw an Exception when provided value is invalid.

Traits

CacheObjectActions

Optional (but helpful) trait that adds usage methods:

Driver

This interface defines methods used for interacting with storage. Currently 1 class exists.

CacheDriver

This class is a default driver that accepts an instance of Illuminate\Contracts\Cache\Store. Binding defined in Service Provider resolves this to your default cache storage.

Events

Default driver dispatches events:

CacheObjectStored

When object is put in storage.

CacheObjectRetrieved

When object is retrieved from storage.

CacheObjectMissed

When cache object retrieval misses.

CacheObjectDeleted

When cache object is removed from storage.

Extending

I created this package with ease of configuration in mind so you can easly create Key, Transformer or Driver that will suit your needs. Additionally if you have any ideas of classes that could be incorporated into main package feel free to open an Issue or Pull Request.

PHPStan

While I omited most of static typing in examples above for clarity, this package is developed with level 8 of PHPStan and parts of code that are working with mixed values (transformers, cache object interface and cache object action) are built with generics.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

All contributions are welcome.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-cache-objects with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eribloo/laravel-cache-objects contains the following files

Loading the files please wait ....