PHP
  Home arrow PHP arrow Building Loader Apps in PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Building Loader Apps in PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    2009-05-27


    Table of Contents:
  • Building Loader Apps in PHP
  • Start building loading programs with a require_once() function
  • Building a basic file loader class
  • The loader class in action

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building Loader Apps in PHP
    ( Page 1 of 4 )

    Loading sources on the fly is one of the most common tasks that PHP programmers have to tackle during the development of web applications. This typical situation must be faced independently of the scale of the programs being created. This means a loader mechanism must be developed. Keep reading as we take a close look at these mechanisms in this eight-part article series.

    Ranging from loading configuration and generic data files, to including classes when using an object-oriented approach, one thing is certain: sooner or later, some kind of effective loader mechanism must be implemented to gather the dependencies required for a particular application.

    Of course, when I mention the term “loader,” you might be thinking that the simplest version of a mechanism like this would be the set of “include/require/” native functions provided by PHP, in all its flavors. And you’d be right; in many cases these functions are the quickest way to include files within a program, according to its specific needs.

    While it’s true that it’s impossible to build modular applications without using includes, it’s also valid to point out that in the older days of PHP 4, these functions had to be called explicitly. Fortunately, with the release of PHP 5 a long time ago, there is no longer any need to invoke them directly, thanks to the incorporation of the handy “__autoload()” magic function.

    Besides, as you may know, PHP 5 comes packaged with the Standard PHP Library (SPL), which includes, among the bunch of powerful classes and interfaces with which it’s armed, two popular functions, called “spl_autoload()” and “spl_autoload_register().” They permit, in the first case, the use of the default implementation for the aforementioned “__autoload()” function and, in the last case, registration of a callback function for loading files.

    With all of these helpful resources freely at your disposal, it’s pretty easy to build full-featured “loader” applications with PHP 5. So, assuming that you’re interested in this topic, in this series of articles I’m going to develop some sample loading applications. I will start with some basic examples, and progressively  add more complexity to them, such as including recursive file loading capabilities.

    Now that you've been introduced to the subject of this article series, it’s time to start learning how to build “loader” programs in PHP 5. Let’s get started!



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

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT