Namespaced code with SabreDAV
| From: | Andrew Mason | Date: | Thu, 06 Oct 2011 14:37:34 +0000 |
| Subject: | Namespaced code with SabreDAV | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-315152@lists.php.net to get a copy of this message | ||
Hello all,
I am trying to use the wonderful SabreDAV library to create a webdav
share. I have a demo up and running however the framework / class i'm
using is namespaced, and SabreDAV unfortunately does not have a 5.3
style namespace declaration.
I have an spl_autoload function registered in my base controller and
so long as I prefix the classname with a \ it all works:
$rootDirectory = new \Sabre_DAV_FS_Directory($rootDir);
// The server object is responsible for making sense out of the WebDAV protocol
$server = new \Sabre_DAV_Server($rootDirectory);
However, SabreDAV it's self has a large amount of other PHP classes
which it calls which obviously aren't prefixed with '\'
Is there a way i can tell PHP any class name that get's instanciated
with 'Sabre_' should resolve to '\Sabre' ?
Many thanks
Andrew