php - Laravel Facade getting properties
Get the solution ↓↓↓I'm trying to wrap the Stripe PHP library with a facade in Laravel. I'm aware that this already exists, but unfortunately it's using a deprecated Stripe API and is behaving unexpectedly.
So I created aFacade
and aServiceProvider
and updated the configuration to reflect this.
This is working as expected. When I try to call a method on myStripe
facade/alias, it redirects to theStripeClient
:
>>> Stripe::foo()
PHP Error: Call to undefined method Stripe/StripeClient::foo() in ...
However, the Stripe api uses class constants, like so:
$stripe = new StripeClient(...);
$stripe->products->all();
But when I try to fetch these properties from the Facade, rather than redirecting to theStripeClient
, it instead tries to get a class constant of theStripe
facade itself.
>>> Stripe::products->all()
PHP Fatal error: Class constant 'App/Facades/Stripe::products' not found ...
So how do I do this?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: to enable extensions, verify that they are enabled in your .ini files
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.