PHPackages                             octha/obfuscator - 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. octha/obfuscator

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

octha/obfuscator
================

Protect your javascript source code with the simplest and fastest way.

55.2k↓32.7%1PHP

Since Apr 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/octhahq/obfuscator)[ Packagist](https://packagist.org/packages/octha/obfuscator)[ RSS](/packages/octha-obfuscator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP javascript obfuscator
=========================

[](#php-javascript-obfuscator)

[![License](https://camo.githubusercontent.com/891419a00e04aa0e311068fa8a04eec92cab4f7026c76278279bf2a1da50e578/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c69676874677265792e737667)](LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/d8bb5f85292e2609f09f1406f17486dac7efb1e477e599490cd3b8ce1d012be2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f637468612f6f626675736361746f72)](https://packagist.org/packages/octha/obfuscator)[![Total Downloads](https://camo.githubusercontent.com/90ee72c5c083e9ac5897e179c900c2d9b90aa282bc3154b754596371ca0d665e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f637468612f6f626675736361746f72)](https://packagist.org/packages/octha/obfuscator)

Protect your javascript source code with the simplest and fastest way to obfuscate javascript with PHP.

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

[](#installation)

```
composer require octha/obfuscator
```

Usage
-----

[](#usage)

### Simple usage to obfuscate JS code

[](#simple-usage-to-obfuscate-js-code)

```
$jsCode = "alert('Hello world!');"; //Simple JS code
$hunter = new \Octha\Obfuscator\Factory($jsCode); //Initialize with JS code in parameter
$obsfucated = $hunter->Obfuscate(); //Do obfuscate and get the obfuscated code
echo "" . $obsfucated . "";
```

### Simple usage to obfuscate HTML code

[](#simple-usage-to-obfuscate-html-code)

```
$htmlCode = "TitleHello world!"; //Simple HTML code
$hunter = new \Octha\Obfuscator\Factory($htmlCode, true); //Initialize with HTML code in first parameter and set second one to TRUE
$obsfucated = $hunter->Obfuscate(); //Do obfuscate and get the obfuscated code
echo "" . $obsfucated . "";
```

> **Note**: If your HTML code contains any JS codes please remove any comments in that js code to prevent issues.

### Set expiration time

[](#set-expiration-time)

```
$hunter->setExpiration('+10 day'); //Expires after 10 days
$hunter->setExpiration('Next Friday'); //Expires next Friday
$hunter->setExpiration('tomorrow'); //Expires tomorrow
$hunter->setExpiration('+5 hours'); //Expires after 5 hours
$hunter->setExpiration('+1 week 3 days 7 hours 5 seconds'); //Expires after +1 week 3 days 7 hours and 5 seconds
```

### Domain name lock

[](#domain-name-lock)

```
$hunter->addDomainName('google.com'); //the generated code will work only on google.com
```

> **Note**: you can add multiple domains by adding one by one.

License
-------

[](#license)

This package is licensed under the [MIT license](LICENSE) © [Octha](https://octha.com).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/682727?v=4)[Andre Goncalves](/maintainers/nicolau)[@nicolau](https://github.com/nicolau)

---

Top Contributors

[![nicxlau](https://avatars.githubusercontent.com/u/17990891?v=4)](https://github.com/nicxlau "nicxlau (2 commits)")

### Embed Badge

![Health badge](/badges/octha-obfuscator/health.svg)

```
[![Health](https://phpackages.com/badges/octha-obfuscator/health.svg)](https://phpackages.com/packages/octha-obfuscator)
```

###  Alternatives

[spatie/laravel-referer

Keep a visitor's original referer in session

532797.4k6](/packages/spatie-laravel-referer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
