Download the PHP package pablok/supercache-bundle without Composer
On this page you can find all versions of the php package pablok/supercache-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pablok/supercache-bundle
More information about pablok/supercache-bundle
Files in pablok/supercache-bundle
Package supercache-bundle
Short Description Supercache bundle for Symfony
License MIT
Homepage https://github.com/kiler129/SupercacheBundle
Informations about the package supercache-bundle
Note
This bundle is a fork of SupercacheBundle which looks like abandoned.
Branch | Build status |
---|---|
master | |
latest stable (0.6.0) |
Supercache Bundle
Static pages caching for Symfony Framework.
What is Supercache?
Some of you may be annoyed looking at simple pages loading times - exactly like me. There's a lot solution for that problem - this is extreme one.
If you ever used Wordpress you probably seen WP Super Cache
plugin. This bundle is build around similar principles (but it is not affiliated in any way) as that plugin.
Basically SupercacheBundle caches whole response to static files and serve them at no cost. It's very useful for pages where there're a lot of static routes visited often.
Installation
Before you start using this bundle you should carefully read HTTP Cache chapter of Symfony Cookbook - it provides a bunch of excellent techniques and tips about caching.
Bundle can be installed like any other Symfony bundle.
- Open a command console, enter your project directory and execute following command:
composer require pablok/supercache-bundle
-
Enable the bundle by adding following line to
app/AppKernel.php
file: Execute following command and follow onscreen instructionsCurrently manual installation is required. You should createapp/console supercache:install
webcache
directory in root folder and than perform first two steps described in Troubleshooting section below.
Configuration
TBD Default configuration:
Troubleshooting
Installation command failed: Failed to create cache directory
Looks like specified cache directory cannot be created. It can be permission related problem. You can try creating it yourself. To do that simply create desired cache directory (by default it's set to ./webcache/
). Next put following content in .htaccess
inside cache directory:
Installation command failed: Failed to modify .htaccess (...)
If you (or some other bundle) modified web/.htaccess
file, installer may be have trouble automatically applying required changes. You can add following lines manually - they should be placed just below RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
(or similar):
Please note cache path need to be adjusted. Path is relative to web/
directory.
My server doesn't support .htaccess
You have two options: translate rewrite rules (specified above) to format supported by server you use or use PHP-PULL mode.
SupercacheBundle contains fallback mode for servers without .htaccess support (e.g. CLI server issued using app/console server:run
command). This mode works by attaching to Symfony HTTP kernel and trying locate cached response for given request. Of course it comes with a price - fallback will run PHP intepretter and initialize core of the framework. In my tests DIRECT mode returns response in 3-5ms while PHP-PULL mode need around 30ms.
There's no need to change any configuration options to enable PHP-PULL.
FAQ
Do all responses gets cached?
No, request & response must meet some criteria to be cached:
GET
request method- No query string
- Response code between 200 and 300 (excluding 204)
- No
private
orno-store
cache control directives - Route is not marked as excluded (see #3 for details)
Are there any limitations?
Yes, there are few:
- It's impossible to serve different content on
/sandbox
and/sandbox/
- You cannot have routes
..
and.
(they are illegal in HTTP RFC anyway) - There are no automatic check for authentication token (it's your responsibility to set
private
cache policy if you're presenting user-specific information) - Due to performance reasons files are served from cache with one of the following MIME-Types: text/html, application/javascript or application/octet-stream. See issue #2 for details.
All versions of supercache-bundle with dependencies
symfony/config Version ~2.8|~3.4|~4.1
symfony/console Version ~2.8|~3.4|~4.1
symfony/dependency-injection Version ~2.8|~3.4|~4.1
symfony/filesystem Version ~2.8|~3.4|~4.1
symfony/framework-bundle Version ~2.8.18|~3.4|~4.1
symfony/http-foundation Version ~2.8|~3.4|~4.1
symfony/http-kernel Version ~2.8|~3.4|~4.1
symfony/routing Version ~2.8|~3.4|~4.1
voku/html-min Version ^3.0.1
voku/simple_html_dom Version ^4.0.1