Reputation: 315
I have run the following command to install Stripe on Yii2:
composer require stripe/stripe-php
The Stripe documentation states to create a config.php file calling the library like this:
require_once('vendor/autoload.php');
However it does not worked, so I changed to
require_once('../vendor/stripe/stripe-php/lib/Stripe.php');
And I got the following error:
yii\base\View::main(): Failed opening required '../vendor/stripe/stripe-php/lib/Stripe.php' (include_path='.:/usr/share/php')"
Any idea of how to call this Stripe library from Yii2?
Upvotes: 1
Views: 1319
Reputation: 18021
Yii 2 composer automatically autoloads extension so you don't have to add require
.
You can simply use library like:
\Stripe\Stripe::setApiKey();
or with namespace use
:
use Stripe\Stripe;
// ...
Stripe::setApiKey();
Upvotes: 1