PHPackages                             davidvarney/phannp - 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. [API Development](/categories/api)
4. /
5. davidvarney/phannp

ActiveLibrary[API Development](/categories/api)

davidvarney/phannp
==================

PHP SDK for the Stannp Direct Mail API

0.0.3(7mo ago)091MITPHPPHP ^7.4|^8.0CI passing

Since Oct 8Pushed 7mo agoCompare

[ Source](https://github.com/davidvarney/phannp)[ Packagist](https://packagist.org/packages/davidvarney/phannp)[ RSS](/packages/davidvarney-phannp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (13)Used By (0)

Phannp
======

[](#phannp)

A modern PHP SDK for the Stannp Direct Mail API.

Installation
------------

[](#installation)

Install via Composer:

```
composer require davidvarney/phannp
```

Developer &amp; testing guide (short)
-------------------------------------

[](#developer--testing-guide-short)

If you're contributing or running tests locally, here's a short guide.

- Run the full test-suite:

```
composer install
./vendor/bin/phpunit --configuration phpunit.xml.dist
```

- Run a single test file for faster feedback:

```
./vendor/bin/phpunit tests/Resources/ToolsTest.php
```

- Use `tests/TestCase.php` helpers:

    - `makeClient()` — returns a `Phannp\\Client` configured with a Guzzle MockHandler preloaded with responses.
    - `makeClientWithHistoryPair()` — returns `[$client, $getHistory]` where `$getHistory()` returns recorded request history (useful to assert outgoing request shapes).
    - `parseMultipartBody()` / `getMultipartParts()` — test helpers to assert multipart uploads.
- Error assertion helpers:

    - `callAndCatchApiException()` — run a callable that should raise `ApiException` and return the caught exception for assertions.
    - `assertApiErrorJsonHasPath()` — assert nested JSON error paths in `ApiException::getResponseJson()`.

### Local commit note

[](#local-commit-note)

Most recent local commit message on this branch:

```
:recycle: Refactors the Tools resource

On branch refactor-resources
 Changes to be committed:
                modified:   src/Resources/Tools.php
                modified:   tests/Resources/ToolsTest.php

```

Discussion: this commit tightens the `Tools` resource API and test coverage:

- `Tools::pdfMerge()` now validates input client-side (requires a non-empty array of strings).
- Tests in `tests/Resources/ToolsTest.php` were updated to assert query param encoding, edge cases and history-based request assertions.

If you pushed this branch, include the commit hash in the changelog entry and consider mentioning the validation behavior in the public README examples.

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Guzzle HTTP client 7.0 or higher

Usage
-----

[](#usage)

### Initialize the Client

[](#initialize-the-client)

```
