PHPackages                             splitbrain/php-jsstrip - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. splitbrain/php-jsstrip

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

splitbrain/php-jsstrip
======================

PHP based JavaScript minimizer

1.0.1(3y ago)1780↓50%BSD-3-ClausePHPPHP &gt;=7.2

Since Mar 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/splitbrain/php-jsstrip)[ Packagist](https://packagist.org/packages/splitbrain/php-jsstrip)[ GitHub Sponsors](https://github.com/sponsors/splitbrain)[ RSS](/packages/splitbrain-php-jsstrip/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

PHP JSStrip
===========

[](#php-jsstrip)

This is a PHP port of Nick Galbreath's python tool [jsstrip.py](https://code.google.com/p/jsstrip/).

It was originally ported to PHP in 2006 as part of the [DokuWiki](http://www.dokuwiki.org) wiki engine. It has received several improvements over the years and is now available as a standalone library.

Quoting the original description:

jsstrip is a open-source library to remove whitespace and comments from a javascript file. You might want to do this to optimize size and performance, or to make a file harder to read. It typically makes 30-40% savings in file size.

**WARNING**

jsstrip is not a true javascript parser. It assumes you have properly delimited the 'end of line' using a ';' (semicolon).

- Yes `print 'foo'; print 'bar';`
- No `print 'foo' print 'bar'`

You'll have to convert your code to use ';' first.

ALWAYS test the stripped version before deploying to production.

Installation
------------

[](#installation)

Install via composer

```
composer require splitbrain/php-jsstrip

```

Usage
-----

[](#usage)

```
