Download the PHP package theriddleofenigma/laravel-rache without Composer

On this page you can find all versions of the php package theriddleofenigma/laravel-rache. 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-rache

♥ Made with <love/> And I love <code/>

Tests Latest Stable Version Total Downloads

Laravel Rache

A super cool package for caching the laravel response dynamically.

Rache caches a route's response and keys it by rache tags — small pieces of request state (the authenticated user, the page number, a search term) that you declare. Two requests share a cached response only when every tag agrees they are equivalent, and any tag can be used later as the handle to flush the cache.

Requirements

Package PHP Laravel / Lumen
2.x 8.2 – 8.4 12.x, 13.x
1.x 7.3 – 8.x 7.x, 8.x (unmaintained)

Laravel 11 is not supported. Its final release (11.55.0) carries unpatched security advisories, so Composer's advisory policy refuses to install it.

Rache uses Laravel cache tags, so the cache store must support tagging. The file, database and dynamodb drivers cannot be used — pick redis, memcached or array.

Upgrading from 1.x? See Upgrading from 1.x.

Installation

The service provider, the Rache facade alias and the rache route middleware alias are registered automatically. The package ships with working defaults, so it is usable immediately — publishing the config is optional.

Service provider and alias (Lumen only)

Add the service provider and alias in bootstrap/app.php:

Lumen has no middleware alias registry, so register the middleware yourself:

Config

Publish the config file to config/rache.php if you want to change the defaults or register your own tags:

Setting the driver

Point Rache at a taggable cache store in your .env:

Leave it unset to use the application's default store. Rache uses the Laravel cache system behind the scenes, so the store must be one configured in config/cache.php.

Middleware

The rache alias is registered for you. To customise the behaviour, subclass the middleware and register your own alias — Rache will not overwrite it:

Rache tags

A rache tag turns the current request into the values that make a cached response unique, and doubles as the handle you flush the cache by. auth, page and request are registered by default; you will find them under the tags key of config/rache.php.

Create your own with either command:

Then fill in getTagDetails():

…and register it in config/rache.php:

Add as many tags as the route has dimensions that make a response different.

Usage

Apply the middleware to a named route, listing the tags that apply. A ttl_<seconds> parameter overrides the configured lifetime and may appear in any position.

Notes:

  1. TTL values are in seconds.
  2. The route must be named — Rache derives its cache tags from the route name and throws MissingRouteNameException otherwise.
  3. Tags are optional. ->middleware('rache') caches the response without varying by anything, which is what you want when a route's response is the same for everyone.
  4. Only GET and HEAD are cached by default. See cacheable_methods.

Flushing

Everything

A tag

Clears every cached response carrying the auth tag, across all routes.

A tag on one route

Omit route and every route carrying the tag is cleared.

A tag for the current user

getTagData() renders the data exactly as it was rendered when the cache was written.

A tag for another user

Only user 2's cache is cleared; everyone else's is untouched.

You can flush any tag, with or without a route and data, from anywhere — a model event, an observer, a queued job, an admin action.

Configuration

Key Env Default Description
enabled RACHE_ENABLED true Master switch. Set to false to bypass the cache entirely.
lifetime RACHE_LIFETIME 3600 Default response lifetime in seconds.
prefix RACHE_PREFIX laravel-rache Prefix applied to every cache key.
cache_store RACHE_DRIVER (app default) Taggable cache store to use.
cacheable_methods ['GET', 'HEAD'] Request methods eligible for caching.
strip_set_cookie_header RACHE_STRIP_SET_COOKIE_HEADER true Remove Set-Cookie before storing, so cookies are not replayed to other visitors.
tags auth, page, request Registered rache tags.

Facade reference

Method Description
Rache::flushAll(): bool Flush every response this package cached.
Rache::flushTag(string $tag, array $options = []): bool Flush a tag, optionally scoped by route and/or data.
Rache::getTagData(string $tag): array The tag's data for the current request.
Rache::getTagInstance(string $tag): RacheTagInterface The tag instance itself.
Rache::getCacheKey(): string Cache key of the current request.
Rache::getCacheTags(): array Cache tags of the current request.
Rache::getRouteName(): string Route name of the current request.
Rache::getLifetime(): int Lifetime in seconds that applies to the current request.
Rache::racheEnabled(): bool Whether caching is enabled.
Rache::isInitialized(): bool Whether the instance has state for the current request.

Which responses get cached?

A response is cached when all of the following hold:

Redirects are cached as a flattened plain response, keeping their status and Location header.

Upgrading from 1.x

2.0 raises the floor to PHP 8.2 and Laravel 12, and fixes several bugs that changed observable behaviour. See CHANGELOG.md for the full list. The short version:

Testing

The suite runs against a Testbench application and needs no database, cache server or credentials.

Contributing

See CONTRIBUTING.md. Please never paste .env contents, cache DSNs, tokens or session cookies into an issue — see SUPPORT.md.

Security

Report vulnerabilities privately. See SECURITY.md.

Credits

License

Copyright © Kumaravel

Laravel Rache is open-sourced software licensed under the MIT license.


All versions of laravel-rache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.0
illuminate/filesystem Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.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 theriddleofenigma/laravel-rache contains the following files

Loading the files please wait ...