Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ArchStanton's avatar

Stripe Package Facade

So I installed the stripe package

https://packagist.org/packages/stripe/stripe-php

And I try and use the wrapper

<?php namespace Mybilling\Billing;

class StripeBilling implements BillingInterface {

function __construct() {
    Stripe::setApiKey(Config::get('stripe.secret_key'));
}
?>

I get the error - Class 'Mybilling\Billing\Stripe' not found

The stripe package is in vendor/stripe, I have run composer so I assume it is being included. Do I need an alias?

0 likes
5 replies
graham's avatar

Did you add the package to your composer.json and the provider/alias to config\app.php?

ArchStanton's avatar

"You need to use the correct namespace for the Stripe facade" - how do I do this?

ArchStanton's avatar

I tried this

    "prs-0": {
            "Playlist": "app/",
            "Stripe": "vendor/stripe"
        }
    },
graham's avatar
graham
Best Answer
Level 12

If you're following the example I think you are:

<?php namespace MyBilling\Billing;
 
use Stripe;
 
use Stripe_Charge;
 
use Stripe_Customer;
 
use Stripe_InvalidRequestError;
 
use Stripe_CardError;
 
use Config;
 
 
 
class StripeBilling implements BillingInterface {

function __construct() {
    Stripe::setApiKey(Config::get('stripe.secret_key'));
}
?>

What have you got for Stripe in composer.json?

1 like

Please or to participate in this conversation.