A quick guide to performance tweaking the PHP based, open-source CMS PyroCMS for best results.
Covers: Image minification, Stream optimisation, file concatenation and htaccess configuration.
2. PyroCMS!
!
PyroCMS is an incredibly powerful yet user friendly CMS
built on the CodeIgniter PHP framework*.
!
It’s both client & developer friendly and runs
very well on a default install.
!
The following slides will offer some tips on
performance tweaking the CMS for best results.
* Soon to be replaced by Laravel in the forthcoming PyroCMS release…any day now!
3. streams:streamName cache="1440" cache_type="query" !
!
// Do stuff here!
!
/streams:streamName
Caching queries within streams where possible
!
The following stream data is cached for a period of 1
day (1440 minutes / 60):
5. Disabling the installer check
!
After successful installation disable the following check
in the hooks.php file (/system/cms/config):
$hook['pre_controller'][] = array(!
! 'function' => 'check_installed',!
! 'filename' => 'check_installed.php',!
! 'filepath' => 'hooks'!
);
6. SetEnv PYRO_ENV production
Set the Pyro environment
!
Within your htaccess file on your remote server set the
PYRO_ENV environment configuration to production:
7. Compress your website assets
!
If you’re running/using an Apache web server configure
your htaccess file to enable gzip compression of assets
such as the following:
!
1. CSS
2. JavaScript
3. Images
4. JSON/XML
5. Web fonts (I.e. TTF, OTF etc)
8. Enable website asset caching
!
Again, if you’re Apache server based, you can configure
your htaccess file to enable caching of website assets.
!
In the following snippet we cache certain asset types for
a period of 1 week (60s * 60m * 24h * 7d = 604800):
<IfModule mod_headers.c> !
<FilesMatch ".(ico|pdf|flv|mp4|ogg|webm|jpg|jpeg|png|
gif|js|css|swf|eot|font.css|otf|ttc|ttf|woff|svg|zip)$"> !
Header set Cache-Control "max-age=604800, public" !
</FilesMatch>!
</IfModule>
9. Optimise your CSS and JS files
!
2 words: minify & concatenate.
!
Wherever possible reduce the size of your CSS & JS files
through minification and concatenation to reduce excess
HTTP requests.
!
PyroCMS offers the Asset plugin which you can use to
help automate the above process (if you’re not using a
front-end workflow automation tool such as Grunt or Gulp).
10. Manage your website images
!
Optimise the size of your website images with tools
like OptiPNG, PNGQuant, Gifsicle, JPEGtran & SVGO.
!
Workflow tools such as Grunt & Gulp offer a rich plug-in
system to help with this (amongst other tasks).
!
Where possible consider using CSS Sprites to reduce
HTTP requests for images.
11. Manage your file references
!
Prevent blocking of your web page loading by moving
references to your external JavaScript files to the bottom
of the page.
!
This can be combined with use of PyroCMS’s Asset
plugin to concatenate/minify JavaScript (as well as CSS)
files.