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.
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_authon yourinclude_pathin the filehybrid/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_Autoloaderstack.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.