ShopifyExtras / PHP-Shopify-API-Wrapper

Shopify PHP (Guzzle) API Wrapper
http://www.zapiet.com/
MIT License
118 stars 68 forks source link

Laravel facade does not load the client #13

Open etorofiev opened 9 years ago

etorofiev commented 9 years ago

I'm unable to load the Client using the Laravel facade. If I change the getFacadeAccessor() method to return 'Shopify\Client' instead of 'shopify', it works fine though. Isn't the facade supposed to return the Client instead of just 'shopify'?

elyobo commented 9 years ago

I'm not familiar with Laravel, but all of the examples showing how to write Laravel facades return a string from the getFacadeAccessor(), not the underlying object, which is instead somehow bound to the application. I can't say that the rest of the implementation is correct (there is some sort of binding of the real underlying object going on in https://github.com/ShopifyExtras/PHP-Shopify-API-Wrapper/blob/master/src/Laravel/ServiceProvider.php), but the getFacadeAccessor() part definitely seems correct.

etorofiev commented 9 years ago

Yes, it turned out I had overwritten my app/config/app.php file with the array of Service Providers, and the facade is working properly after I fixed it.

I would however add a line in the readme file for reminding people who use Laravel to include that service provider in their app.php file, since it's easy to forget it otherwise :)

elyobo commented 9 years ago

I'm sure that @cargi would be happy for a pull request that adds appropriate docs. I don't have a clue about Laravel, so I can't do it :D