Reputation: 551
I'm adding a 3rd party library (Hybrid Auth) to my zend project. The main class called is hybrid_auth. I'm assuming that having an underscore in the class name with throw an error in zend? Should I rename this class throughout the library or would it be better to create my own autoloader?
Forgive the brevity, I'm on my phone and will try to update later.
Thanks.
Upvotes: 0
Views: 394
Reputation: 14184
It won't throw an error, per se. Underscores in classnames are perfectly fine.
But the default autoloader will try to find the class hybrid_auth
on your include_path
in the file hybrid/auth.php
.
You can either:
Do a manual include before referencing the class so that autoloading doesn't kick in
Write a custom autoloader for this class - and any others like it - and push that autoloader onto the Zend_Loader_Autoloader
stack.
Rename the class and/or filename to be PSR-0-compliant so the standard autoloader is happy with it.
Personally, I'd go with (2): write your own autoloader. I hate to monkey-patch 3rd-party library code because subsequent lib updates overwrite my hack.
For writing your own autoloaders, take a look at this.
Upvotes: 2