[wp-hackers] concatinating PHP code files

Andrew Gray andrew at graymerica.com
Mon Mar 22 18:51:30 UTC 2010


including files has almost no overhead on the server level.   You can use APC encoder to save your self a lot of overhead and statically create php byte code if you are worried about that.

Also, having lots of files makes using source control much easier.  One big file would be a mess.  You would have to update the entire thing instead of the small changes.

As for searching, almost any editor (Textmate, text wrangler, dream weaver for mac) have a directory search. I am sure the same is true on windows / linux.  

> 
> Grep doesn't quite look like what I want. I want to do it mostly to satisfy my curiousity.



Watch out for that, it kill cats. :)

Andrew



On Mar 22, 2010, at 2:40 PM, Arlen Beiler wrote:

> The main thing would be that it would make searching easier. However, for
> something like Wordpress, you would have a file so big that only something
> like Microsoft Word or a web browser could handle it.
> 
> On Mon, Mar 22, 2010 at 2:37 PM, Chris Jean <gaarai at gaarai.com> wrote:
> 
>> I don't know of anything that does this. I'm really curious to know why you
>> would want to.
>> 
>> If you only needed to do it once, just manually merge them (though I still
>> don't know why you'd want to). If it needed to handle random code in an
>> automated fashion, what application would require this?
>> 
>> If you really needed this, it sounds like you would want to build a custom
>> script that uses regex (http://www.regular-expressions.info/) to parse the
>> files in order to find the include, include_once, require, require_once
>> instances and replace them with the content of the files. Of course, if
>> include_once or require_once is used, log the file so it is only included
>> once.
>> 
>> Chris Jean (AKA gaarai & chrisbliss18)
>> Coder for http://ithemes.com/
>> http://gaarai.com/
>> @chrisjean
>> 
>> 
>> 
>> Arlen Beiler wrote:
>> 
>>> Is there a way to specify a start file and have php build a new file out
>>> of
>>> the inludes and requires it finds? Say I have 5 files, #1 includes the
>>> other
>>> 4 at runtime. Can I have it take the code in those other files and insert
>>> it
>>> where the include is the way PHP does when it runs?
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> 
>>> 
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list