I'm not a PHP guy, but on the java-script side if you are going to have lots of modules that you would like to keep as independent as possible there are several systems for this, such as RequireJS, that have java-script modules that declare dependencies on other modules, and the framework makes sure they are loaded when needed.
The various frameworks out there vary in how dependencies are declared, how much dependency handling is done as a build step on the server, on page load, or dynamically upon request, and in how much you have to change the way you write your java-script.
These frameworks don't apply as much (or perhaps at all) if your server side framework is handling this or generating your java-script for you, but you could possibly want your java-script to be independent of your server side framework.
If you don't have too much java-script but you want some modularity, you can always stick to anonymous self calling functions that handle dependencies by ordering the script tags with dependencies first, and referencing each other by registering themselves with a single object in the global namespace. That at least makes them nearly modular and doesn't cost you much to implement.