Aching Brain Just another WordPress weblog

ClassLoader

Introduction

A PHP5 class that simplifies (hopefully) the dynamic loading of class definition files and adds a memetic namespace of dubious value.

Installation

Both versions are the same and require PHP5.

Usage

Treat this like the import directive in Java. So, to import a file:

  1. ClassLoader::import('packageName.className')

Or to import a folder of files:

  1. ClassLoader::import('packageName.*')

Your class files should be named according to the following convention: ClassName.php, ClassName.class.php, ClassName.interface.php or similar, and be in folders. Edit the variable ClassLoader::$className to reflect your setup. Enjoy!

Changelog

Version 0.1

Initial release. Probably quite badly broken.

Popularity: 2% [?]

Comments (2) Trackbacks (0)
  1. Hi, I really like this class. I have one little update for line 144- 146. Why don’t you take them together in one line? Like:
    exit (’

    ClassLoader Error

    ' . $e->getMessage() . '
    ’);

    I changed the string a little.

  2. and some more stuff. :)

    1) The last example you give here does not work because you always prepend (line 154) $_SERVER['DOCUMENT_ROOT']. Your example would become: /var/www/html/usr/local/share/php5/myclasses/


Leave a comment


No trackbacks yet.

Pages

Categories

Blogroll

Archive

Meta