定制 psr18-adapter/stripe-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

psr18-adapter/stripe-php

最新稳定版本:1.1

Composer 安装命令:

composer require psr18-adapter/stripe-php

包简介

README 文档

README

Install

Via Composer

composer require psr18-adapter/stripe-php

Usage

stripe-php library uses singleton for setting the http client, so you will have to call it at some point before you start calling Stripe itself, like so

\Stripe\ApiRequestor::setHttpClient(
    new \Psr18Adapter\Stripe\StripePsr18Client($psr18Client, $psr7UriFactory, $psr7RequestFactory)
);

How to set up for dependency injection containers

Singletons like ApiRequestor cannot really be configured for dependency injection containers like symfony/dependency-injection without writing extra layer as well. This is why I'm shipping such layer within this package too, in case you are also finding that you need to write such layer, but don't really want to.

It's used like following, if you use YAML and symfony/dependency-injection

services:
    Stripe\StripeClient:
      factory: ['Psr18Adapter\Stripe\StripeClientAccessor', 'access']
      arguments:
        - !service
          class: Stripe\StripeClient
          arguments:
              $config:
                api_key: '%stripe_secret_key%'
        - !service
          class: Psr18Adapter\Stripe\StripePsr18Client
          autowire: true

This should be a replacement of definition of Stripe\StripeClient service itself.

Advantage of this approach is that it ensures http client is set in singleton before retrieving \Stripe\StripeClient service. This means you can be confident any time StripeClient is fetched from container, it's already configured with your PSR-18 HTTP client.

Licensing

MIT license. Please see License File for more information.

统计信息

  • 总下载量: 684
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固