定制 nestednet/gocardless-laravel 二次开发

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

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

nestednet/gocardless-laravel

Composer 安装命令:

composer require nestednet/gocardless-laravel

包简介

GoCardless Pro PHP Client package integration for Laravel.

README 文档

README

Build Status Scrutinizer Code Quality Latest Stable Version Latest Unstable Version License

GoCardless Pro PHP Client package integration for Laravel.

This package tries to provide an easy, scalable and maintainable way to integrate Gocardless into your laravel project.

It provides a Facade that wraps the Gocardless PHP client and also an easy way to handle the webhooks that Gocardless sends. This is done following the steps that Spatie uses for their Stripe Laravel Webhooks package.

Installation

Get the package with composer:

composer require nestednet/gocardless-laravel

1. If you are using Laravel >5.5 the package will be autodiscobered, for older versions add the service provider at your config/app.php file.

2. Publish the configuration file

$ php artisan vendor:publish --provider="Nestednet\Gocardless\GocardlessServiceProvider"

This will publish both the configuration file and the migration file.

3. Review the configuration file

config/gocardless.php

and add your Gocardless API token and environment to the .env file.

4. After publishing the migration you can run the migration and create the gocardless_webhooks_table

5. The package provides a Macro route (gocardlessWebhooks). You can create a route at your routes file of your app. This route will be the endpoint where Gocardless will send the webhooks, you should register this webhook endpoint at your Gocardless dashboard.

Route::gocardlessWebhooks('gocardless-webhook-endpoint');

This will register a POST route to a the controller provided by this package. You should add the route to the except array of the VerifyCsrfToken middleware.

protected $except = [
    'gocardless-webhook-endpoint',
];
Usage

Once the package is properly installed you can use the Gocardless facade to access the methods of the Gocardless PHP client. The documentation of this methods can be found here: Gocardless PHP cleint documentation

If you use Gocardless at your project you provably will use webhooks to handle the asynchronous payment states. This package provides an easy way to handle the webhooks.

Gocardless will send you webhooks with events. This events will contain the updates of your Gocardless resources.

This package will verify the signature of the requests and if it's valid. Unless something goes terribly wrong, and even if one of the events inside the webhook fails the controller will reposnd with a 200 to Gocardless. This prevents Gocardless from spamming retries to the endpoint.

If an event fails to be processed the exception will be saved to the database into the gocardless_webhook_calls table, you can find the failed events there.

This package provides two ways to handle the webhook requests:

  • Using jobs
  • Using events
Using jobs

You can find a jobs array inside the config\gocardless.php.

You can register any job that you want to the gocardless events. An event from Gocardless references one resource resource_type and one action. In order to register a job to an action you should add it with the key {resource_type}_{action}.

'jobs' => [
 // '{resource_type}_{action} => path/to/job::class,
    'payments_created' => App\Jobs\PaymentConfirmed::class,
]

In order to avoid timeouts it's highly recommended to use queued jobs.

Using events

Every time an event is processed by the package it will trigger an event with this structure:

gocardless-webhooks::{resource_type}_{action}

The payload of the event will be the GocardlessWebhookCall (or an extended model) instance created with the request.

You can register listeners to this events in the EventServiceProvider:

/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    'gocardless-webhooks::payments_created' => [
        App\Listeners\ListenerOfPaymentsCreated::class,
    ],
];

nestednet/gocardless-laravel 适用场景与选型建议

nestednet/gocardless-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.52k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2019 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「gocardless」 「laravel」 「nestednet」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nestednet/gocardless-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nestednet/gocardless-laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 nestednet/gocardless-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 13
  • Watchers: 4
  • Forks: 15
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-28