Optimizing the code to increase performance of a site is a challenging task for developers. We have to work on the process like compression, caching, concatenation, embedding and also optimizing the images.
Luckily we have found SmartOptimizer [ SmartOptimizer is a PHP library ] to do all this functionalities. This will drop half the Loading time of your site of the previous performance.
SmartOptimizer Features
- SmartOptimizer increases your website download speed by reducing the size of JavaScript and CSS files approximately up to 80% or even higher.
- SmartOptimizer reduces count of http requests by concatenating JS/CSS files together.
- It also reduces http requests by embedding CSS images and CSS imported files.
- If your website has a large amount of JavaScript and CSS files, SmartOptimizer reduces your monthly bandwidth usage amazingly.
- SmartOptimizer generates minified, compressed, combined and embedded files on the first request and caches them on the server and uses the cache on future requests.
- It doesn’t embed duplicated urls (i.e. css sprites) in css files for better performance.
- It also knows to regenerate already cached files if the originals have been changed.
- SmartOptimizer handles browsers that doesn’t support gzip encoding and sends them non-gzipped content.
- It also forces the browser to cache the files optionally forever or until they have not changed.
- SmartOptimizer removes Etag headers. (for better performance on clustered servers).
- It is very easy to install and usually there is no need to do any changes on your codes.
Installation Instructions
- Extract archive file and copy smartoptimizer folder to your website.
- SmartOptimizer will need write access to the cache folder (placed in smartoptimizer folder).
- If Apache mod_rewrite is enabled on your website, you should place .htaccess file beside smartoptimizer folder. and if your website already have a .htaccess file, you should properly modify it to add required rules. (to do this copy smartoptimizer htaccess contents and paset it inside your current htaccess at the begining of the file.)
- If your website has a large amount of JavaScript and CSS files, SmartOptimizer reduces your monthly bandwidth usage amazingly.
- If Apache mod_rewrite is not enabled or if your web server is not Apache, you should change all of JavaScript and CSS urls used on your website from “path/to/file/filename” to “smartoptimizer/?path/to/file/filename”.
See the following examples :
Script tag:
{code type=css}< {/code}
CSS link:
{code type=css}
CSS @import rule:
@import url("smartoptimizer/?path/to/file/cssfile.css");
Note that the folder structure must be something like this:
/public_html
.htaccess
/smartoptimizer
/cache
config.php
index.php{/code} To use concatenation feature, the files should be placed in the same place. and links to the files should be like the following examples:
Read More Information:
Configuration Options SmartOptimizer has a configuration file named config.php. The following configurations can be defined in this file. However it works with default configurations.
debug: true or false
By setting this option to true, In case of error a message containing error details will be alerted. So it will be very helpful setting this option to true if SmartOptimizer doesn't work for you (that it may be due to a misconfiguration or bad installation).
charSet: utf-8 or iso-8859-1
The character set encoding of your js and css files.
baseDir: base directory for your files
This should be typically root path of your site.SmartOptimizer prevents including files from outside of this directory
serverCache: true or false
You can disable server side cache by setting this option to false (useful for development and debugging purposes).
ClientCache: true or false
You can prevent the browser from caching the files at client side.(useful for development and debugging purposes).
cacheDir:directory where the cached files will be stored.
You can prevent the browser from caching the files at client side.(useful for development and debugging purposes).
Typically there is no need to change this option.
gzip: true or false
You can disable/enable gzip compression through this option.(useful for development and debugging purposes)
gzipExceptions: an array of file formats.
This is an array of file formats that should not be compressed when gzip compression is enabled.
minify: true or false
you can enable/disable minify functionality through this option.
concatenate: true or false
you can enable/disable concatenate functionality through this option.
separator: File names separator
To use concatenate functionality you should separate file names with this separator.
embed: true or false
you can enable/disable embedding functionality through this option.
embedMaxSize: number of bytes
The maximum size of an embedded file. (use 0 for unlimited size)
Download Link: http://farhadi.ir/downloads/smartoptimizer-1.7-beta.tar.gz
Site url : http://farhadi.ir/works/smartoptimizer
This entry was posted on Friday, February 26th, 2010 at 12:37 am and is filed under General Topic. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.












June 1st, 2010 at 3:42 am
…Your point is valueble for me. Thanks. I know it is the cheap Fully automatic espresso guide!…
December 5th, 2010 at 10:14 pm
…Hi, thanks so a great deal for these suggestions!…
December 22nd, 2010 at 11:33 pm
…wonderful guidance and sharing,I’ll get this great for me .thank you!…
January 8th, 2011 at 9:55 am
Excellent article, a great deal of valuable information.January 23rd, 2011 at 5:07 pm
…Thanks for such a great post and the review, I am wholly impressed!…
February 4th, 2011 at 12:14 am
Good post once again!…February 5th, 2011 at 8:46 am
…Really inspiring submit, Thanks !!…
May 16th, 2011 at 10:19 pm
nice, good postAugust 30th, 2011 at 9:47 pm
I just subscribe your weblog. That is a complete nice weblog.Soon I do know that I was right.Thanks for your current information you article.September 2nd, 2011 at 2:15 am
You should take part in a contest for one of the best blogs on the web. I will recommend this site!