Download the PHP package davidvarney/phannp without Composer

On this page you can find all versions of the php package davidvarney/phannp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phannp

Phannp

A modern PHP SDK for the Stannp Direct Mail API.

Installation

Install via Composer:

Developer & testing guide (short)

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

Local commit note

Most recent local commit message on this branch:

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

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

Usage

Initialize the Client

Postcards

Postcards::create parameters

Example using a template (future-proof):

Letters

Letters::create parameters

Example — create using a template id and recipient id:

Example — post a pre-merged file (resource or URL):

Recipients

Groups

Events

Files

Multipart uploads (files)

The SDK supports uploading files either by file path, by resource (e.g. fopen), or by URL. In tests we use Guzzle's history middleware to inspect outgoing requests and assert multipart bodies.

Upload examples:

Additional upload examples

Asserting multipart in tests

Use the test helper makeClientWithHistoryPair() to capture outgoing requests and parseMultipartBody() / getMultipartParts() to inspect multipart parts.

Concrete test assertion example (full snippet)

Reporting

Campaigns

Selections

Account

Account top-up caveats

Addresses

Notes on Addresses validation

If you need to assert what the SDK sends, the test helpers add a Guzzle history middleware so any outgoing requests can be inspected in tests.

Asserting outgoing requests (examples)

Example — ergonomic pair helper (recommended):

Example — manual history (pass-by-reference):

Notes:

Quick helper: name => body map

If you only care about the parts' bodies (not filenames or disposition details) use getMultipartParts() which returns a simple name=>body map:

Tools

Utilities and Countries helper

This SDK includes a small utilities module under src/Utilities/.

Example:

SMS

Error Handling

The SDK throws exceptions when API requests fail:

Changelog (recent)

For a full changelog see CHANGELOG.md in the project root.

More detailed error handling

The SDK also defines Phannp\Exceptions\PhannpException for client-side errors (validation, argument issues) and Phannp\Exceptions\ApiException for server/API errors. Example showing both:

php try { $client->campaigns->approve(123); } catch (ApiException $e) { $status = $e->getStatusCode(); $raw = $e->getResponseBody(); $json = $e->getResponseJson();

echo "Status: {$status}\n";
if ($json) {
    // Inspect structured error fields
    echo 'API message: ' . ($json['message'] ?? $json['error'] ?? json_encode($json));
} else {
    // Fallback to raw body
    echo 'Raw response: ' . $raw;
}

}

License

MIT

Testing

This repository includes a PHPUnit test suite that exercises the Phannp\Client and every resource under src/Resources.

What the tests cover

How the tests work

Run tests locally

  1. Install dependencies (from the project root):

  2. Run the test suite with the vendor PHPUnit binary:

Run an individual test file:

Continuous Integration

The tests are self-contained and suitable for CI. A simple GitHub Actions workflow should install composer dependencies and run ./vendor/bin/phpunit --configuration phpunit.xml.dist.

Extending the tests


All versions of phannp with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package davidvarney/phannp contains the following files

Loading the files please wait ...