Re: Structure of PHP files
| From: | Robert Cummings | Date: | Thu, 23 Jul 2009 13:34:37 +0000 |
| Subject: | Re: Structure of PHP files | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295742@lists.php.net to get a copy of this message | ||
Floyd Resler wrote:
When I first started programming in PHP I used the second method you mentioned. I had a single file I called utils.php and it contained all the functions I could possibly need throughout my site. Unfortunately, this file grew to be over 10,000 lines and most of the time I only needed a couple of functions for each script I loaded. I have now abandoned that method and use a more modular approach. I have a lib folder that contains much smaller and specialized scripts (mainly classes). Now I only include what I need. I found it much easier to maintain than having a single file.Not that I disagree with your methodology at this time, but you could have just made that single big file, include all those little files and still had a single load statement in each of your consumer source files. With compile caches the burden of loading all that code at startup is rather negligible :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP