php - Laravel Facade getting propertiesGet 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 a
Facade and a
ServiceProvider and updated the configuration to reflect this.
This is working as expected. When I try to call a method on my
Stripe facade/alias, it redirects to the
>>> 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 the
StripeClient, it instead tries to get a class constant of the
Stripe facade itself.
>>> Stripe::products->all() PHP Fatal error: Class constant 'App/Facades/Stripe::products' not found ...
So how do I do this?
People are also looking for solutions of the problem: apache/2.4.52 (win64) openssl/1.1.1m php/8.1.2 server at localhost port 80
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.
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.