
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
UglifyPHP is a JavaScript minifier and simple obfuscator for PHP files
UglifyPHP is a JavaScript minifier and simple obfuscator for PHP files.
This package use a unique ID based on the current time to replace variables. You can use two minified files together and don't have to worry with variable overwriting.
This package can minify Classes
and replace correctly variables and functions references with $this
. It will not change any function name or create "junk code" for performance reasons.
This should not be used as a licensing or code protection solution.
npm install uglify-php
const UglifyPHP = require('uglify-php');
let options = {
"excludes": [
'$GLOBALS',
'$_SERVER',
'$_GET',
'$_POST',
'$_FILES',
'$_REQUEST',
'$_SESSION',
'$_ENV',
'$_COOKIE',
'$php_errormsg',
'$HTTP_RAW_POST_DATA',
'$http_response_header',
'$argc',
'$argv',
'$this'
],
"minify": {
"replace_variables": true,
"remove_whitespace": true,
"remove_comments": true,
"minify_html": false
},
"output": "C:/web/file_min.php" // If it's empty the promise will return the minified source code
}
// You can use a path or the source code
UglifyPHP.minify("C:/web/file.php", options).then(function (source) {
console.log(source);
});
Original Source Code:
<?php
class BaseClass {
private $name = "Uglify-PHP";
function __construct() {
$this->sayHello();
}
// Comment Block
public function sayHello(){
echo "Hello " . $this->name;
}
}
$obj = new BaseClass();
?>
Minified Source Code:
<?php class BaseClass{private $j5lg3rhh="Uglify-PHP";function __construct(){$this->sayHello();}public function sayHello(){echo "Hello ".$this->j5lg3rhh;}}$j5lg3rhj=new BaseClass();?>
FAQs
UglifyPHP is a JavaScript minifier and simple obfuscator for PHP files
The npm package uglify-php receives a total of 95 weekly downloads. As such, uglify-php popularity was classified as not popular.
We found that uglify-php demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.