note 92707 deleted from language.namespaces.definition by salathe
| From: | salathe@php.net | Date: | Tue, 15 Feb 2011 16:24:48 +0000 |
| Subject: | note 92707 deleted from language.namespaces.definition by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177008@lists.php.net to get a copy of this message | ||
Note Submitter: jurrien at jpdokter dot nl
----
I have written a Packager class that allows to use packages and namespaces. It does require the
folder layout. If the __autoload function is not yet "re-implemented", it'll create
its own __autoload function.
It is written in PHP5 and does not require > PHP5.3, moreover, I don't have PHP5.3 since
XAMPP is not adding it yet. Don't ask me why.
Since it's over 300 lines long, I am not going to post it here. But if someone would like to
have a look?
Basic uses:
<?php
# /classes
# /package1
# class34.class.php
# /package2
# classone.class.php
require_once('packager.class.php');
#Packager::debug(true);
Packager::addClasspath(dirname(__FILE__).'/classes', true); // true means that it
overrules the predefined set.
Packager::addClassSuffix(array('.class.php'),true); // true means that it overrules the
predefined set.
Packager::import("package1.Class34"); // java-style
Packager::import("package2::ClassOne"); // php-style
echo Packager::dump(); // show us what you got!
?>