Download the PHP package duva-mail/duva without Composer

On this page you can find all versions of the php package duva-mail/duva. 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 duva

Duva for PHP

The official Duva client library for PHP. Duva is a transactional email API hosted in Canada.

Requires PHP 8.2 or later.

Sending a message

Reading events and pagination

events->list() and suppressions->list() return one page (->data, ->nextCursor); events->listAll() and suppressions->listAll() return a Generator that follows nextCursor for you, without ever loading every page into memory, optionally bounded with maxItems:.

Verifying a webhook

$rawBody must be the exact bytes Duva sent (file_get_contents('php://input'), not a re-serialized parsed body): re-encoding it changes the bytes and invalidates the signature. Rotating your webhook secret? Pass an array — Webhooks::constructEvent([$old, $new], ...) — while both are active.

Errors

Every error Duva answers with is a Duva\Exceptions\DuvaException subclass; rely on ->errorCode (the contract), never on the exception message (its wording can change):

Network failures and timeouts throw Duva\Exceptions\ConnectionException / TimeoutException instead (no HTTP response was ever received). Reads and messages->send() (idempotency-key protected) are retried automatically on a transient failure; suppressions->add()/remove() and webhooks->create()/delete() are not, because the outcome of a timed-out first attempt is unknown. A 429 quota_exceeded is never retried automatically (its retryAfter can be hours); a 429 rate_limited is, as long as the wait fits within maxRetryWaitSeconds (30s by default).

Attachments

Attachment::fromBytes($filename, $content, contentType: null, contentId: null) works from data already in memory; contentId turns the attachment into an inline image the HTML references with cid:.

Testing your own application

Duva\Http\TestTransport records every RequestSpec sent and lets you script the responses: no network call, no separate HTTP mocking library required.

Configuration

Argument Default
apiKey: DUVA_API_KEY Required.
domain: DUVA_DOMAIN Required: the domain this key was created for.
baseUrl: https://api.duva.ca
timeout: 10 (seconds)
maxRetries: 2 Network failures / 5xx on a safe-to-retry call.
maxRetryWaitSeconds: 30 A 429 rate_limited with a longer wait is not retried.
language: unset "en" or "fr": the language of error.message.
transport: a Psr18Transport built from Guzzle Inject any Duva\Http\TransportInterface (a different PSR-18 client, proxying, tests).

Only psr/http-client, psr/http-message and psr/http-factory (interfaces) are hard dependencies. Without an injected transport:, the client builds a default one from guzzlehttp/guzzle (composer require guzzlehttp/guzzle if you haven't); to use a different PSR-18 client instead, wrap it in Duva\Http\Psr18Transport yourself and pass it as transport:.

Full reference

The complete API surface and the OpenAPI specification this library follows: https://duva.ca/en/docs and https://duva.ca/openapi.json.

Development

Response types are hand-written value objects (src/Models/, readonly classes): PHP is the other language in docs/bibliotheques-clientes.md §4/§5 (besides Ruby) without an idiomatic single-purpose "models from OpenAPI" generator — openapi-generator's PHP output is verbose, mutable getter/setter/ArrayAccess classes, not the strict readonly types this library targets. The client itself (retries, pagination, errors, webhooks) is checked against the shared fixtures published in duva-mail/duva-conformance.

License

MIT, see LICENSE.


All versions of duva with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.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 duva-mail/duva contains the following files

Loading the files please wait ...