1

I need to add the payment system library to my project on Ocrober CMS ( https://github.com/yandex-money/yandex-checkout-sdk-php ). In this regard, the question is:

Can I do this using only the classes of my plugin, or is there a way to automatically integrate this into the project? If so, how can I do this without rewriting namespace and use at the beginning of php files? There is information about this on Github, but it is not clear how to use it.

Titamik
  • 39
  • 6
  • you can use composer, init with composer in your plugins root directory and add this lib using `composer require` , it will available automatically in you component / or project wide. – Hardik Satasiya Oct 14 '20 at 18:01
  • @HardikSatasiya I installed composer in my openserver, how do I add this class (or plugin) to my OctoberCMS build now? P.S. I have never Worked with composer, especially in conjunction with October. – Titamik Oct 14 '20 at 19:18

1 Answers1

3
  1. Install composer in your system/server

  2. open terminal and go to in your plugin's root folder for ex. plugins/author/pluginName

  3. composer require stripe/stripe-php <- use this command please replace package as per your need

  4. once package installation is done you are able to use your library, for ex: $stripeClient = new \Stripe\StripeClient()...

according to your need

  1. in terminal go to your plugin's root directory
  2. composer init -> then fill default infos
  3. composer require yandex-money/yandex-checkout-sdk-php
  4. use it in code
// import 
use YandexCheckout\Client;

// use
$client = new Client();
$client->setAuth('shopId', 'secretKey');

if any doubt please comment.

Hardik Satasiya
  • 9,547
  • 3
  • 22
  • 40
  • 1
    Thank you very much! Everything seems to work. In the future, I will read the documentation, because the tool is useful and very popular. I'm already ashamed not to know(( – Titamik Oct 14 '20 at 19:59
  • I am glad it helped you, yes composer is great tool :), its never late to learn new things , now you know composer cheers . – Hardik Satasiya Oct 15 '20 at 06:40