Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Script Compression/"Compilation" Tools

Are there any more generic tools that can "compile" or basically merge multiple PHP files into a single file based on includes and autoloading classes? I'm thinking of something similar to Doctrine's compiling functionality or the compiling that many of the major JS frameworks do for "production" sites to lighten the file size and improve performance.

Before writing a script to do it myself, I just want to find out if anything worth looking at already exists (Google hasn't been much help so far).

Edit: I've actually written a blog post about the .phar archive format and am very excited about that. I was actually more concerned about performance, but it sounds like merging files would not yield any benefit.

Does anyone have any real data that might suggest the performance gain (or lack thereof) from merging multiple scripts into a single file?

like image 688
Wilco Avatar asked Aug 08 '26 05:08

Wilco


1 Answers

Out of curiosity, why do you want to do this? If it's for performance, don't bother. Just use regular includes instead of auto-loading, and it will have much of the same effect. For performance you're better off looking at one of the run-time caching solutions.

like image 98
Joeri Sebrechts Avatar answered Aug 09 '26 19:08

Joeri Sebrechts



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!