views:

647

answers:

4

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?

+1  A: 

I am not a php programmer, but I have seen something called "phar" file. Its like jar for php. maybe u shud look into that

A quick google search reveals

http://pear.php.net/pepr/pepr-proposal-show.php?id=88

http://www.pixelated-dreams.com/archives/78-PHAR-PHPs-Answer-to-.jar.html

Midhat
+1  A: 

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.

Joeri Sebrechts
A: 

I have run across the YUI Compressor for .NET that is hosted on codeplex.

It will compress both JavaScript and CSS files in your project.

I haven't tried it yet, but I am very interested in it.

You can easily integrate it into your msbuild script.

For more information you can visit http://developer.yahoo.com/yui/compressor/

Elijah Manor
A: 

As someone said, Phar is what you're looking for. But I don't think it will increase performance. And, it will be available in PHP's next version.

ign
this means it'll be available on my crappy hosting plan in about 7 years, woo! (I'm STILL waiting for them to upgrade to PHP5... wtf...)
nickf