Skip to content

w3l/scriptify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scriptify

Usage

<?php
echo (new w3l\scriptify)->encode('
var owner = "us";
alert("All your base are belong to " + owner);
');

Results:

<script src="scriptify.php?js=dmFyIG93bmVyPSJ1cyI7YWxlcnQoIkFsbCB5b3VyIGJhc2UgYXJlIGJlbG9uZyB0byAiK293bmVyKQ%3D%3D" integrity="sha384-e7SU+5i8b6bk4ck7S4uufgvLeOPVujVWDF4LdCN/H/5IPQVC021203V7dcB+MLFI"></script>

It's also possible to send attributes:

echo (new w3l\scriptify)->encode('
<script async crossorigin="anonymous">
var owner = "us";
alert("All your base are belong to " + owner);
</script>
');

Results:

<script src="scriptify.php?js=dmFyIG93bmVyPSJ1cyI7YWxlcnQoIkFsbCB5b3VyIGJhc2UgYXJlIGJlbG9uZyB0byAiK293bmVyKQ%3D%3D" integrity="sha384-e7SU+5i8b6bk4ck7S4uufgvLeOPVujVWDF4LdCN/H/5IPQVC021203V7dcB+MLFI" async crossorigin="anonymous"></script>

Call w3l\scriptify::decode to generate the code externally:

var owner="us";alert("All your base are belong to "+owner)

Example scriptify.php

<?php
header("Content-Type: application/javascript");
echo (new w3l\scriptify)->decode($_GET["js"] ?? "");

Releases

No releases published

Packages

No packages published

Languages