Home arrow PHP arrow Including Files Recursively with Loader Applications in PHP

Including Files Recursively with Loader Applications in PHP

Welcome to the fourth chapter of the series that shows you how to build loader applications with PHP. Made up of seven parts, this series uses a variety of code samples to teach you how to create modular programs. These programs are capable of recursively including files required by a given application, without having to explicitly call any “include()/include_once()” or “require()/require_once()” PHP function.

TABLE OF CONTENTS:
  1. Including Files Recursively with Loader Applications in PHP
  2. Review: the loader() class so far
  3. Recursively including PHP files
  4. Changing the location of required files
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
June 11, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

And now that you’ve been introduced to the main goal of this series, it’s time to summarize the topics that were discussed in the last tutorial. In the previous part I went through the development of a file loading class in PHP 5. This class was capable of searching recursively for a determined file on the web server, based on a starting path passed to its “load()” main method.

Having a class like this makes it much easier to dynamically load resources and dependencies that may be located in different folders on the server. Its recursive “load()” method does the hard work and takes care of the whole loading process, independently of the location of a required file. 

Nonetheless, the best way to understand how this loader class works and how functional it can be in concrete situations is by setting up several examples that show it in action. 

Bearing in mind this idea, in this fourth installment of the series I’m going to provide you with a number of code samples that will demonstrate the actual benefits of using the “Loader” class created in the preceding tutorial. 

Now, let’s leave the boring theory behind us and see the real functionality of this recursive file loader program. Let’s jump in!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap

Dev Shed Tutorial Topics: