Download the PHP package dereuromark/cakephp-url-cache without Composer

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

CakePHP UrlCache plugin

Build Status Latest Stable Version Coverage Status Minimum PHP Version License Total Downloads

For CakePHP 2.x

Whenever you use $this->Html->link() in your CakePHP views the CakePHP Router has to scan through all your routes until it finds a match. This can be slow if you have a lot of links on a page or use a lot of custom routes. By adding this code to your AppHelper the URLs are cached, speeding up requests. The cache settings follow the same rules as the other CakePHP core cache settings. If debug is set to greater than 0 the cache expires in 10 seconds. With debug at 0 the cache is good for 999 days.

Instructions

  1. Download the plugin to app/Plugin/UrlCache manually or include it via composer.

  2. Put at the top of your app/View/Helper/AppHelper.php:

  3. Load and activate Plugin in app/Config/bootstrap.php:

  4. Have your AppHelper extend UrlCacheAppHelper instead of Helper:

  5. That's it! Just continue using $this->Html->link() or $this->Html->url() as you usually do.

Configuration

By default all the cache will be stored in one file. This is only recommended for sites with not many links. If your site has a ton of unique URLs you don't want to store them all in one giant cache which would need to be loaded each request. So in case you have a large amount of links on specific pages, and if they contain more than just the main URL fragments (prefix, plugin, controller, action) like with pagination you can set the option Configure::write('UrlCache.pageFiles', true) and each page will additionally keep a separate cache for those unique URLs. Only the controller/action URLs without named or passed params will then be stored in the global cache.

There is also a Configure::write('UrlCache.verbosePrefixes', true) param. It is useful if you defined some prefixes in your core.php like Configure::write('Routing.prefixes', ['admin']); and if you mainly still use the old 1.2/1.3 syntax for prefixes:

instead of

The latter is more future proof, though.

Debugging

With the de-facto-standard debugging tool DebugKit you can enable a toolbar panel that allows you to see how many links have been used and/or added per page view. To enable it, you can add it to your $components configuration:

Benchmark

With a little sample script you can at least approximate the improvement for your (custom) routes:

With the first request with my test it was 9 seconds, the second hit only 1 second. So in overall the speed improvement can be around 10x faster. It really depends on how dynamic your pages and URLs are, though. And the above 10000 links is not a realistic scenario, so the overall speed improvement compared to the whole dispatcher process will be usually a lot less. So you definitely should look into other bottlenecks, usually the DB, opcode caching, and dispatching speed in general.


All versions of cakephp-url-cache with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
composer/installers Version *
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 dereuromark/cakephp-url-cache contains the following files

Loading the files please wait ....