Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
A correct way to add auth drivers?
  • I wrote auth drivers SuperAuth & Twitter. If I use them, I get errors:
    Fatal error: Class 'Auth_Login_Superauth' not found in /home/virtwww/site/http/fuel/packages/auth/classes/auth/login/driver.php on line 36 An unrecoverable error occurred.
    
    I added to packages/auth/bootstrap.php following code:
    'Auth\\Auth_Acl_Superacl'  => __DIR__.'/classes/auth/acl/superacl.php',
     'Auth\\Auth_Group_Supergroup' => __DIR__.'/classes/auth/group/supergroup.php',
     'Auth\\Auth_Login_Superauth' => __DIR__.'/classes/auth/login/superauth.php',
    

    Is this a correct way to add load driver classes?
  • I'd guess there's something wrong with the path, but in general you shouldn't do it like this. A package should be dealt with just like core classes: don't extend them inside their own directory because you won't be able to update them after that.
    Extend by placing your own driver in app/classes/auth/login/superauth.php and it should just work.
  • Jelmer Schreuder wrote on 02/03/11 10:46 am:
    I'd guess there's something wrong with the path, but in general you shouldn't do it like this. A package should be dealt with just like core classes: don't extend them inside their own directory because you won't be able to update them after that.
    Extend by placing your own driver in app/classes/auth/login/superauth.php and it should just work.

    I placed in path app/classes/auth/login/ But there is error:
    Fatal error: Class 'Auth_Login_Superauth' not found in /home/virtwww/site/http/fuel/packages/auth/classes/auth/login/driver.php on line 36 An unrecoverable error occurred. I think there is bug in package:( Autoload don't work...
  • I'm pretty sure there's no such bug as I'm using it myself in this way. The error will always come from that location as that's where the loading of the driver is attempted. Check your paths, check you classname and make sure they match. path: app/classes/auth/login/superauth.php
    classname: Auth_Login_SuperAuth
    namespace: none, must be in global
  • I deleted Namespace and voila all work fine!!! I have one question: which correct of this?
    class Auth_Login_SuperAuth extends \Auth_Login_Driver {
    
    class Auth_Login_SuperAuth extends \Auth_Login_SimpleAuth {
    
  • Could you show be the class decleration (beginning of the file until just after "class Auth_Login_SuperAuth extends Auth_Login_Driver" ) and a screenshot of your file structure to the file? Just to clarify why I want to see that: the error you're shown is a PHP error saying it can't find the class Auth_Login_Superauth, which is not a problem with the Auth but with autoloading that specific class. As the autoloading has been tested pretty thoroughly I still suspect there's a problem with where you put the file.
  • Jelmer Schreuder wrote on 02/03/11 12:43 pm:
    Could you show be the class decleration (beginning of the file until just after "class Auth_Login_SuperAuth extends Auth_Login_Driver" ) and a screenshot of your file structure to the file? Just to clarify why I want to see that: the error you're shown is a PHP error saying it can't find the class Auth_Login_Superauth, which is not a problem with the Auth but with autoloading that specific class. As the autoloading has been tested pretty thoroughly I still suspect there's a problem with where you put the file.

    Thanks, I deleted namespace and all work fine.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion