Laravel 4, Composer and hybridauth - How to load additional providers
Asked Answered
G

2

7

I'm using Laravel 4 and have loaded hybridauth via composer and got it working just fine with Facebook and Twitter. Now i'm trying to get it working with Steam, which is listed as an additional provider, however I keep getting the following error:

require_once(vendor/hybridauth/hybridauth/hybridauth/Hybrid/Providers/Steam.php) [function.require-once]: failed to open stream: No such file or directory

Clearly it's looking in the wrong place, the actual class resides in this location:

vendor/hybridauth/hybridauth/additional-providers/hybridauth-steam/Providers/Steam.php

There's very little documentation that I can find on this, my only guess is that the author of hybridauth only offered these additional providers as optional extras and expects you to move the location of the class to the proper place, however with composer this isn't the way to do things and will cause problems anytime I run composer update.

I can't find anyone having a similar problem via Google, which seems strange so i'm worried i'm missing obvious. Is there a way to use the additional providers, to have them autoload, while using hybridauth with Composer?

The only solution I can think to do is to manually include the correct file before it tries to autoload. I don't mind doing that, but i'm assuming there must be a proper way to do this otherwise using Composer with Hybridauth is fairly useless.

Granniah answered 3/9, 2013 at 12:42 Comment(1)
clearly something's wrong with the library.Decomposed
P
4

I had this problem with Instagram and was able to use the wrapper syntax, which is documented here http://hybridauth.sourceforge.net/userguide/tuts/specific-provider-wrapper.html

The code below got the Instagram adapter working for me.

           "Instagram" => array ( 
                "enabled" => true,
                "keys"    => array ( 
                    "id" => xxxx, 
                    "secret" => xxxx,
                ),
                "wrapper" => array(
                    'class'=>'Hybrid_Providers_Instagram',
                    'path' => $_SERVER['DOCUMENT_ROOT'].'/../vendor/hybridauth/hybridauth/additional-providers/hybridauth-instagram/Providers/Instagram.php'
                )
            ),

If you read the source at hybridauth/Hybrid/Provider_Adapter.php line 69, you'll see it checks for this before doing require_once with the standard path.

Paramagnet answered 30/1, 2014 at 6:36 Comment(0)
U
-1

I searched and searched for this as well. All I can think of is that it was made for use without frameworks, then was ported to be used with Composer, however the "additional providers" folder isn't loaded, or something. It kinda sucks.

I just copied the file into the other directory, and everything works now.

This maybe handy for you...

http://blog.elliothesp.co.uk/coding/laravel-4-and-hybrid-auth/

Part regarding this:

Copy the Steam.php file, located at:
laravel/vendor/hybridauth/hybridauth/additional-providers/hybridauth-steam/Providers/Steam.php

Over to:

laravel/vendor/hybridauth/hybridauth/hybridauth/Hybrid/Providers/

I've no idea why the library has them separated, doesn't make any sense to me.

Unfetter answered 6/9, 2013 at 14:7 Comment(2)
Cheers, will this cause a problem with composer update though?Granniah
Nope, I haven't had any problems. Although I guess if the Steam.php file got updated, it wouldn't be updated in your project, you'd have to do the same again. I tried to contact the developer, but never got anything back.Unfetter

© 2022 - 2024 — McMap. All rights reserved.