PHPackages                             teamgantt/dues - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. teamgantt/dues

ActiveLibrary[Payment Processing](/categories/payments)

teamgantt/dues
==============

1.1.0(2y ago)217.6k1MITPHPPHP &gt;=8.1

Since Dec 1Pushed 2y ago5 watchersCompare

[ Source](https://github.com/teamgantt/dues)[ Packagist](https://packagist.org/packages/teamgantt/dues)[ Docs](https://github.com/teamgant/dues)[ RSS](/packages/teamgantt-dues/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (6)Versions (5)Used By (0)

dues
====

[](#dues)

Table of Contents
-----------------

[](#table-of-contents)

- [Goals](#goals)
- [Installation](#installation)
- [Usage](#usage)
- [Development](#development)
- [Testing](#testing)
- [Conventions](#conventions)

### Goals

[](#goals)

Dues is meant to provide a high level API for processing payments, particularly subscriptions.

It is designed to be processor agnostic, but currently only supports Braintree.

### Installation

[](#installation)

Dues isn't currently published to [packagist](https://packagist.org/). Until it is, it is recommended that dues be installed from the `main` branch using composer's [vcs](https://getcomposer.org/doc/02-libraries.md#publishing-to-a-vcs) functionality.

Your `composer.json` should include the following:

```
{
  "repositories": [
    {
      "url": "https://github.com/teamgantt/dues",
      "type": "vcs"
    }
  ],
  "require": {
    "teamgantt/dues": "dev-main",
  }
}
```

See composer documentation for specifying a specific commit.

### Usage

[](#usage)

The high level API of dues is accessed by constructing a `Dues` instance with a gateway implementation.

```
use TeamGantt\Dues\Dues;
use TeamGantt\Dues\Processor\Braintree;

$gateway = new Braintree([
    'environment' => $_ENV['BRAINTREE_ENVIRONMENT'],
    'merchantId' => $_ENV['BRAINTREE_MERCHANT_ID'],
    'publicKey' => $_ENV['BRAINTREE_PUBLIC_KEY'],
    'privateKey' => $_ENV['BRAINTREE_PRIVATE_KEY'],
]);

$dues = new Dues($gateway);
```

All functionality supported by dues can be found on the [`Dues`](src/Dues.php) class.

*Note*: some of dues' public API is mixed in via a [trait](src/Processor/ProcessesSubscriptions.php).

#### Events

[](#events)

Dues provides support for handling certain events via the the `addListener` method. This method expects an implementation of the [`EventListener`](src/Contracts/EventListener.php) interface.

```
interface EventListener
{
    public function onAfterCreateCustomer(Customer $customer): void;

    public function onAfterUpdateCustomer(Customer $customer): void;

    public function onBeforeCreateCustomer(Customer $customer): void;

    public function onBeforeUpdateCustomer(Customer $customer): void;

    public function onAfterCreateSubscription(Subscription $subscription): void;

    public function onAfterUpdateSubscription(Subscription $subscription): void;

    public function onBeforeCreateSubscription(Subscription $subscription): void;

    public function onBeforeUpdateSubscription(Subscription $subscription): void;
}
```

A listener can be removed by calling `removeEventListener` with the same instance.

```
$dues->removeListener($listener);
```

Events are useful for logging, analytics, and other integrations (such as dealing with taxes).

### Development

[](#development)

Dues is developed against PHP version 8.1

A [Dockerfile](Dockerfile) is provided for a consistent development environment.

The provided commands in `bin/` assume a docker image named `dues` with a tag of `dev`. You can build this from the root of the repo:

```
docker build . -t dues:dev
```

It is recommended, though not necessary, to use [direnv](https://direnv.net/) for development. If direnv is installed, the `.envrc` file will automatically be loaded when entering the project directory. This will allow developers to use the `php` and `composer` commands without having to install them locally. All `composer` commands will be run transparently through the docker container.

#### Executing from the docker container without direnv

[](#executing-from-the-docker-container-without-direnv)

You can use the scripts provided in `bin/` directly

```
$ bin/composer test
```

### Testing

[](#testing)

Dues aims for very high test coverage. Tests are written using [PHPUnit](https://phpunit.de/).

The test suite is broken into unit tests and integration tests.

Individual mileage may vary when running integration tests locally, but the suite is designed to be run in a CI environment. CI tests run against a BrainTree sandbox environment configured by TeamGantt.

To run unit tests locally, run `composer test:unit`.

To run integration tests locally, run `composer test:integration`.

Integration and unit tests are not separated by any kind of file naming convention, but instead they are grouped together. An integration test should be annotated using a `@group` annotation.

```
/**
 * @group integration
 */
public function testAProcesserRequest()
{

}
```

Tests are organized by feature in the `tests/Feature` directory.

#### BrainTree tests

[](#braintree-tests)

In order to ensure a consistent test environment, the Braintree tests are run against a sandbox environment. It is important that "duplicate transaction checking" is disabled. This will allow integrations to run tests with the same data multiple times without unexpected results.

Please see the Braintree [documentation](https://articles.braintreepayments.com/control-panel/transactions/duplicate-checking#configuring-duplicate-transaction-checking) for more information on configuring duplicate transaction checking.

### Conventions

[](#conventions)

Dues aims to be consistent in style and type correctness. Code conventions are enforced using [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer). The list of conventions can be found in the [`.php-cs-fixer.php`](.php-cs-fixer.php) file.

Static analysis is perfomed using [phpstan](https://phpstan.org/). See [phpstan.neon](phpstan.neon) for configuration.

There are composer scripts provided for checking conventions and running static analysis.

```
$ composer run fix
$ composer run check
$ composer run analyse
```

*Note:* `composer run fix` will automatically fix any CodeSniffer issues that can be fixed automatically. This is not always possible, so it is recommended that `composer run check` be run before committing code.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 51.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~333 days

Total

4

Last Release

986d ago

Major Versions

0.0.2 → 1.0.02023-06-08

PHP version history (2 changes)0.0.1PHP &gt;=7.4

1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/59413656492e3afbb7bb42fa9a5bc7ebce978a48da7ac2e5a8cf7e7f6ef6b5c2?d=identicon)[johncorrelli](/maintainers/johncorrelli)

---

Top Contributors

[![brianium](https://avatars.githubusercontent.com/u/636651?v=4)](https://github.com/brianium "brianium (75 commits)")[![johncorrelli](https://avatars.githubusercontent.com/u/18272064?v=4)](https://github.com/johncorrelli "johncorrelli (59 commits)")[![jcalebj](https://avatars.githubusercontent.com/u/5686190?v=4)](https://github.com/jcalebj "jcalebj (5 commits)")[![vandyand](https://avatars.githubusercontent.com/u/34038526?v=4)](https://github.com/vandyand "vandyand (3 commits)")[![gitwilliam](https://avatars.githubusercontent.com/u/1936859?v=4)](https://github.com/gitwilliam "gitwilliam (2 commits)")[![ismyrnow](https://avatars.githubusercontent.com/u/1127410?v=4)](https://github.com/ismyrnow "ismyrnow (1 commits)")

---

Tags

payment processingpaymentsubscriptionsteamgantt

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/teamgantt-dues/health.svg)

```
[![Health](https://phpackages.com/badges/teamgantt-dues/health.svg)](https://phpackages.com/packages/teamgantt-dues)
```

###  Alternatives

[omise/omise-php

A PHP library designed specifically to connect with Omise API.

71478.0k6](/packages/omise-omise-php)[cybersource/rest-client-php

Client SDK for CyberSource REST APIs

39881.3k6](/packages/cybersource-rest-client-php)[sumup/sumup-ecom-php-sdk

SumUp PHP SDK

51277.1k1](/packages/sumup-sumup-ecom-php-sdk)[omnipay/braintree

Braintree gateway for Omnipay payment processing library

35558.0k3](/packages/omnipay-braintree)[enupal/stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS 3.x

3416.5k1](/packages/enupal-stripe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
