Download the PHP package getgrav/cache without Composer

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

Cache

Build status paypal

This is a lightweight cache system based on file and directories.

Usage

Step 1: Install it

Via composer:

Or with a clone of the repository:

Or downloading it:

Step 2: Setup the rights

You need your PHP script to have access to the cache directory, you can for instance create a cache directory (be sure the web server can write it):

Step 3: Access the cache

To access the cache, you can do like this:

This will render a red square. If the cache file (which will look like `cache/r/e/d/-/s/red-square.png') exists, it will be read, else, the closure will be called in order to create the cache file.

API

You can use the following methods:

Note: consider using an hash for the $filename cache file, to avoid special characters.

Conditions

You can use conditions to manage file expirations on the cache, there is two way of expiring:

For instance, if you want to uppercase a file:

This will be create the uppercase.txt cache file by uppercasing the original.txt if the cache file does not exists or if the original.txt file is more recent than the cache file.

For instance:

Cache directory and actual cache directory

In some cases, you'll want to get the cache file name. For instance, if you're caching images, you'll want to give a string like cache/s/o/m/e/i/someimage.png to put it into an <img> tag. This can be done by passing the $file argument to the getOrCreate to true, or directly using getCacheFile method (see above).

However, the visible cache directory of your users is not the same as the absolute path you want to access. To do that, you can set both the cache directory and the actual cache directory.

The cache directory is the prefix visible by the users (for instance: cache/s/o/m/e/i/someimage.png), and the actual cache directory is the prefix to use to actually access to the image (for instance: /var/www/somesite/cache/s/o/m/e/i/someimage.png). This way, the file will be accessed using absolute path and the cache file returned will directly be usable for your user's browsers.

License

This repository is under the MIT license, have a look at the LICENCE file.


All versions of cache with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
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 getgrav/cache contains the following files

Loading the files please wait ....