Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uglify-php

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uglify-php

UglifyPHP is a JavaScript minifier and obfuscator for PHP files.

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
124
increased by22.77%
Maintainers
1
Weekly downloads
 
Created
Source

UglifyPHP

UglifyPHP is a JavaScript minifier and obfuscator for PHP files.

How It Works

This package use a unique ID based on the current time to replace variables. You can include two minified files and don't have to worry with variable overwriting.

This package can minify Classes replace correctly variables and functions references with $this.

This should not be used as a licensing solution.

Installation

$ npm install uglify-php

Usage

const UglifyPHP = require('uglify-php');

UglifyPHP.minify("C:/web/file.php", { // optional options object
	"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
	},
	"output": "C:/web/file_min.php" // If it's empty the promise will return the minified source code
}).then(function (source) {
    console.log(source);
});

Example

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();?>

Keywords

FAQs

Package last updated on 26 Jul 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc