Skip to content
Static cache for Fuelphp framework. Render output to real files and serve them improving performance.
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead of floorish:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Static cache for Fuelphp framework

This is a port of Lysender's kohana module

How to

  1. Enable the package in your fuel instance

  2. Create a 'cache' folder in your docroot (or change config to update folder name)

  3. Add this code to the Controller_Template 'before' function:

    $this->pagecache = new Pagecache();
  1. Add this code to the Controller_Template 'after' function:

    $response = parent::after($response);


    if ($this->pagecache->isCacheable()) {

    return $response;
  1. Enable cache in your controller


  2. Update your .htaccess to have the following code

    RewriteRule ^/(.*)/$ /$1 [QSA]
    RewriteRule ^$ cache/index.html [QSA]
    RewriteRule ^([^.]+)/$ cache/$1/index.html [QSA]
    RewriteRule ^([^.]+)$ cache/$1/index.html [QSA]

    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d

    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]   
You can’t perform that action at this time.