Stripe Library |
I'm having problems migrating my CI3 Stripe Library to CI4.
I've run composer require stripe/stripe-php and a truck load of code has ended up in my vendor folder (as expected). I've created a StripePayments.php file in app/Libraries with the following code Code: <?php But my intelephense vscode linter extension is telling me "Nope, not gonna happen" I've googled and searched github for a couple of hours now. Hopefully someone here will be able to point me in the right direction
I believe that you need to add a use clause just above the class name.
PHP Code: use Stripe\StripeClient; No sure if that is what is callusing your warning. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(05-14-2021, 01:32 AM)InsiteFX Wrote: I believe that you need to add a use clause just above the class name. Hi InsiteFX, Thanks very much for your help again. Unfortunately I'm still getting a thumbs down from intelephense. It is displaying Undefined type 'Stripe\StripeClient' for the Stripe instantiation in the constructor Code: <?php Do you think I should add anything to app\Config\Autoload.php ?
If you add their library then you need to add it to the class map in the autoload.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Hi InsiteFX,
I have a success Turns out I can ignore the undefined type 'Stripe\StripeClient' error flagged by intelephense, although I suspect intelephense will be strictly correct. btw - the intelephense vcs extension is awesome, if anyone is interested I'm not an OOP guru, but have grasp of the main concepts. I'm going to post some of my code here , if anyone else is looking to add Stripe to their app. As per the docs, I installed Stripe via composer. I have a FrontController that extends the baseController and then I have a "Front" folder (under app/Controllers) of controllers that extend the FrontController - one of them is called Main.php Here is the beginning of Main.php showing that I've temporarily hijacked the about page to test my Stripe connection. Code: <?php I have a StripePayments.php file under app/Libraries Here is the beginning of the code showing listCustomers and getBalance functions Code: <?php I did not need to add anything to app/Config/Autoload.php Hope this helps others. Feel free to tell me I "this is not the way" or I should be using services
I personally use the phpStorm editor, doe's all the updates right from the editor.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Kindly check this tutorial :
https://getsamplecode.com/blog/codeignit...ntegration |
Welcome Guest, Not a member yet? Register Sign In |