I'm working on a public project and one of the things we are after is a CSS file merger and minimizer and a js file merger and minimizer. The requisites are as follows:
If the system is only a minimizer I can do the merging in the server myself (string concatenation) and use the minimizer later.
When there's something new to compress, I use the system (e.g. a class, a function, etc...) that I call when I want to minify the js or the CSS. Its output is supposed to be placed to a file, so if it's output can go directly to a file great(!), if it's just a string returned to the program, good(!) My program is the one who knows when the compressed file is supposed to be substituted and the one who deals the access to the file.
This is for a project that must work where all outside communication by the php's initiative is disabled and where most functionalities are disabled to somewhat sound like. That means no url includes, no curl, no url file_get_contents(), no exec(), etc...
Note: There are lots of questions in this website about this subject. The problem is that most of them are to generalist and do not answer what I need (Ex: is more interested in suggesting YUI or compressors that are currently known to have bugs).
I already tried to find this in the internet but I can only find old abandoned projects or I get compressors that require the use of the command line interface.
For CSS, I personally use CSSMin with great results. It is a plain PHP solution, and it is even able to simulate CSS variables, with a @variable
declaration.
For JS files, I call Google Closure Compiler with curl
which does not meet your needs.