Firstly,i use https://validator.prestashop.com/generator generate new module,name "mymodule"
then,i use compoer init to generate composer json like this:
{ "name": "jinber/mymodule", "autoload": { "psr-4": { "Jinber\\Mymodule\\": "src/" }, "classmap": [ "mymodule.php", "controllers/", "classes/" ] }, "require": {}, "config": { "preferred-install": "dist", "classmap-authoritative": true, "optimize-autoloader": true, "prepend-autoloader": false } }
next i use composer require wechatpay/wechatpay to install this sdk
now,my vendor like this:
this sdk use guzzlehttp 7+
when i follow sdk doc created some code, i got error:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined method GuzzleHttp\\Utils::chooseHandler() in /www/wwwroot/p.shoucangjie.xin/modules/mymodule/vendor/guzzlehttp/guzzle/src/HandlerStack.php:49\nStack trace:\n#0 /www/wwwroot/p.shoucangjie.xin/modules/mymodule/vendor/wechatpay/wechatpay/src/ClientXmlTrait.php(123): GuzzleHttp\\HandlerStack::create()\n#1 /www/wwwroot/p.shoucangjie.xin/modules/mymodule/vendor/wechatpay/wechatpay/src/ClientDecorator.php(103): WeChatPay\\ClientDecorator::xmlBased()\n#2 /www/wwwroot/p.shoucangjie.xin/modules/mymodule/vendor/wechatpay/wechatpay/src/Builder.php(43): WeChatPay\\ClientDecorator->__construct()\n#3 /www/wwwroot/p.shoucangjie.xin/modules/mymodule/classes/WePayServer.php(9): WeChatPay\\Builder::factory()\n#4 /www/wwwroot/p.shoucangjie.xin/modules/mymodule/mymodule.php(244): WePayServer->jsapiPay()\n#5 /www/wwwroot/p.shoucangjie.xin/modules/mymodule/controllers/front/jsapi.php(12): Etrestapi->getPayInfo()\n#6 /www/wwwroot/p.shoucangjie.xin/classes/contro...', referer: https://servicewechat.com/wx8bf53686614eb4e6/devtools/page-frame.html
no matter include vendor/autoload.php or not and run composer dump-autoload on modules/mymodule/ . always show this error
note: this sdk in symfony project work fine and chooseHandler function exists