PHP Classes

Laravel HTML Encoding: Obfuscate HTML encoding it a JavaScript code

Recommend this page to a friend!
  Info   View files Documentation   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 119 All time: 9,509 This week: 455Up
Version License PHP version Categories
laravel-html-encodin 1.0.1The PHP License5HTML, PHP 5


This package can obfuscate HTML encoding it a JavaScript code.

It takes an HTML string and generates HTML with JavaScript code which when loaded in a Web page, it would render the given HTMl code on a Web page.

Picture of Nyi Nyi Lwin
  Performance   Level  
Name: Nyi Nyi Lwin <contact>
Classes: 12 packages by
Country: Myanmar Myanmar
Age: 31
All time rank: 26685 in Myanmar Myanmar
Week rank: 89 Up1 in Myanmar Myanmar Up
Innovation award
Innovation award
Nominee: 7x

Winner: 4x


Laravel Html Encrypt

Latest Stable Version Total Downloads


You can install the package via composer:

 composer require php-junior/laravel-html-encrypt

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php



php artisan vendor:publish --provider="PhpJunior\LaravelHtmlEncrypt\LaravelHtmlEncryptServiceProvider"

This is the contents of the published config file:

return [
    'encrypt' => env('HTML_ENCRYPT', true),
    'disable_right_click'       => true,
    'disable_ctrl_and_F12_key'  => true,

HTML Encryption?

One major reason for the success of the World Wide Web is undeniably the openness of HTML. HTML files are basically plain text documents, meaning software applications and human users can easily create, read, and update web pages. The open nature of HTML not only allows users to edit websites with nothing more than a simple text editor, it also enables search engines to spider the web and forms the basis for a wide range of web-related applications for any platform you can imagine.

However, as a web designer or website owner you may encounter situations in which you feel a need for protecting your HTML, CSS or JavaScript code from being viewed and reused .

How It Works

HTML encryption/decryption techniques are based on JavaScript. The encrypted HTML code, which is saved inside the HTML document, is decrypted at runtime through JavaScript and written directly into the browser window using the document.write(?) function. This ensures that any JavaScript-enabled web browser can load and display the pages without additional components or plugins.


The MIT License (MIT). Please see License File for more information.

Support on Beerpay

Hey dude! Help me out for a couple of :beers:!

Beerpay Beerpay

  Files folder image Files  
File Role Description
Files folder imageconfig (1 file)
Files folder imagesrc (1 file, 1 directory)
Files folder imagetests (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file laravel-html-encrypt.php Aux. Auxiliary script

  Files folder image Files  /  src  
File Role Description
Files folder imageMiddleware (1 file)
  Plain text file LaravelHtmlEncryptServiceProvider.php Class Class source

  Files folder image Files  /  src  /  Middleware  
File Role Description
  Plain text file HtmlEncrypt.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file HtmlEncryptTest.php Class Class source
  Plain text file TestCase.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,509
This week:455Up