PHP Classes

PHP JavaScript Minifier: Optimize JavaScript by removing unnecessary code

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 83 All time: 10,047 This week: 81Up
Version License PHP version Categories
javascript-minifier 1.0.0Custom (specified...5PHP 5, Compression, Performance and o...


This class can optimize JavaScript by removing unnecessary code.

It can take a string with JavaScript and perform several types of optimizations to to reduce the size of the resulting code.

Currently the class can remove comments, convert line breaks with to characters into just one, etc..

Picture of Luca Liscio
  Performance   Level  
Name: Luca Liscio <contact>
Classes: 5 packages by
Country: Italy Italy
Age: 42
All time rank: 4081166 in Italy Italy
Week rank: 41 Up2 in Italy Italy Up
Innovation award
Innovation award
Nominee: 2x



 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
require_once 'lib/Minifier.php';

$js = "";
$cfg->infiles as $file) {
"Minify: ".$file."\n";
$js .= \JShrink\Minifier::minify(file_get_contents("in/".$file));

"\n\nSaving: ".$cfg->outfile."\n";
file_put_contents("out/".$cfg->outfile, $js);



Simple JavaScript Minifier written in PHP

  Files folder image Files  
File Role Description
Files folder imagelib (1 file)
Files folder imagenbproject (2 files)
Accessible without login Plain text file config.php Conf. Configuration script
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  lib  
File Role Description
  Plain text file Minifier.php Class Class source

  Files folder image Files  /  nbproject  
File Role Description
  Accessible without login Plain text file Data Auxiliary data
  Accessible without login Plain text file project.xml Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,047
This week:81Up