Download the PHP package monolyth/cachet without Composer

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

monolyth/cachet

Cachebuster command

When serving static assets (mainly JavaScript and CSS, but perhaps also images...) sometimes you'll want to "bust" the browser cache to make sure visitors receive the correct version. This is what cachet aims to help in.

Installation

Composer (recommended):

Usage

cachet depends on a global "versions file" where all current versions are stored. This should contain a JSON hash of all files/hashes (relative to your projet's root directory). Initially you can fill it with empty strings as the hashes; on first run, the actual hashes will be replaced:

Whenever you run the cachet CLI command, the current hashes will be inserted or updated (based on the files' contents):

The command also creates symlinks with the correct hash inserted into the public folder, e.g. test.js might become test.abcdabcd.js. You should refer to these linked files in your frontend code, as the hash will change when the file contents have changed.

Note that both arguments are relative to the current working directory.

Injecting version numbers in templates

Monolyth projects usually use Twig, so we've included a TwigFunction cachet to easily inject the correct version numbers.

Somewhere in a central place in your application, inject it using your Twig\Enviroment of choice:

Note that when injecting the Twig environment, you need to pass the full path to the versions file since getcwd() has an undefined meaning here.

In your Twig template, pass the filename to be cache-busted through the cachet function:

An optional second parameter to the cachet function may be set to false to disable all cache-busting; this is handy during development. You'll probably already have a way to determine whether or not the code is running in production. A fake example:

Note, by the way, the leading slash in the src attribute.

Fault tolerance

The Twig cachet function returns the original filename if no such "bustable" file was defined. This is the same behaviour as when the second argument is false.

If E_NOTICE level errors are enabled though (a good idea during development and testing) an error of level E_USER_NOTICE will be triggered.


All versions of cachet with dependencies

PHP Build Version
Package Version
Requires monolyth/cliff Version ^0.7.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 monolyth/cachet contains the following files

Loading the files please wait ....