SmartOptimizer : Smart solution for optimizing your code

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

  • Share/Bookmark

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.

10 Responses to “SmartOptimizer : Smart solution for optimizing your code”

  1. Automatic espresso guide Says:

    Your point is valueble for me. Thanks. I know it is the cheap Fully automatic espresso guide!…

  2. Coach sale Says:

    Hi, thanks so a great deal for these suggestions!…

  3. Chanel tote Says:

    wonderful guidance and sharing,I’ll get this great for me .thank you!…

  4. Msn Weather Says:

    Excellent article, a great deal of valuable information.

  5. MBT Shoes Clearance Says:

    Thanks for such a great post and the review, I am wholly impressed!…

  6. Bidcac Says:

    Good post once again!…

  7. Gucci Outlets Says:

    Really inspiring submit, Thanks !!…

  8. surf Says:

    nice, good post

  9. davisbeats Says:

    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.

  10. Sunni Wilm Says:

    You should take part in a contest for one of the best blogs on the web. I will recommend this site!

Leave a Reply

« Back to text comment