The obfuscator will deliver the obfuscated version of "real-path-to-js/my-js-code.js".
The obfuscator will search through all the directory entries under the "repository-name" for the "my-js-code.js" file. When founded, it wil obfuscate it and deliver it to the requester. There is no way for the client-side to find out where the actual real source code of "my-js-code.js" is located.
There are several ways to configure a repository:
<?php return array( __DIR__ . '/../a/relative/path/to/js/files', __DIR__ . '/../another/relative/path/to/js/files', '/absolute/path/to/js/files1', '/absolute/path/to/js/files2', );
To deliver obfuscated code for the file "my-js-code.js" use the following snippet:
Of course, file "my-js-code.js" must exists in one of the directories specified in the repository. Also, the file must be unique across the directories belonging to the repository.
A very usual scenario is that the repository contains just a single directory.
__DIR__PHP function to retrieve the absolute path of the current repository file, and relatively start build from there the desired paths (like the first two directories in the sample above).
Even the directory path of a repository entry remains unknown for the outside world, you can furthermore protect it by using a .htaccess file that will limit the access more drastically.
<Files ~ "\.js$"> Order allow,deny Deny from all </Files>
This method is suitable (but not recommended) if the obfuscator will be used for only a single application.
It somehow shortens the usage snippet, but there is no such a big difference: