Skip to content

Static cache for Fuelphp framework. Render output to real files and serve them improving performance.

Notifications You must be signed in to change notification settings

floorish/fuel-pagecache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

fuel-pagecache

Static cache for Fuelphp framework

This is a port of Lysender's kohana module https://github.com/lysender/pagecache

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();
    $this->pagecache->setResponse($this->response);
    $this->pagecache->setRequest($this->request);
  1. Add this code to the Controller_Template 'after' function: (inside auto_render snippet)
    if ($this->pagecache->isCacheable()) {
       $this->pagecache->cache($_SERVER['REQUEST_URI']);
    }
  1. Enable cache in your controller

    $this->_pagecache->enableCache();

  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]   

About

Static cache for Fuelphp framework. Render output to real files and serve them improving performance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages