Download the PHP package couryo/couryo-php without Composer

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

couryo/couryo-php

Official PHP SDK for the Couryo email API. Leia em português.

Not on Packagist yet. Inside the Couryo monorepo it lives in packages/sdk-php; until it is published, install it from a path repository (see below).

Install

Before it is on Packagist, point Composer to the folder:

Send an email

Responses are associative arrays with the same fields as the API JSON.

Pass your own key when the same business event may be sent twice: $couryo->emails->send($body, ['idempotency_key' => 'order-1042-confirmation']). Every POST method accepts this options array.

Saved templates

Contacts, events and campaigns

Errors

PHP reserves Exception::$code for an integer, so the API code (domain_not_verified, rate_limited...) is in getErrorCode() and in the $e->errorCode property, and getCode() returns the HTTP status (0 for network errors). Also available: getType(), getDocUrl(), getRetryAfter() and getError() (the whole error object).

Each type has its own class, all extending CouryoException: InvalidRequestError, AuthenticationError, PermissionError, NotFoundError, ConflictError, RateLimitError, TierLimitError, ApiError and NetworkError (network failure or timeout, status 0).

message follows the language option (pt-BR by default, or en).

Webhooks

Use the raw body exactly as it arrived, never JSON that was decoded and encoded again.

Plain PHP:

Laravel (a route without CSRF protection, such as routes/api.php):

Webhook::verify accepts any header array (getallheaders(), $_SERVER, $request->headers->all()), looks them up without case sensitivity and throws WebhookVerificationError for a wrong signature or a timestamp older than 5 minutes ($toleranceSeconds, the fourth argument). Webhook::sign() builds a valid signature for your tests.

Laravel

The service provider is discovered automatically. It reads COURYO_API_KEY (or config('services.couryo.key')), binds Couryo\Couryo as a singleton (also app('couryo')) and registers the couryo mail transport.

.env:

config/mail.php, inside mailers:

Then send as usual:

From, to, cc, bcc, reply-to, subject, HTML, text, attachments and inline images go to the API. Tags (tags: [...] in the Mailable envelope or ->tag()) become Couryo tags (as does an X-Couryo-Tags: kind=order, store=downtown header), metadata becomes metadata, other X-* headers go in headers, and an X-Couryo-Stream: marketing header picks the stream. php artisan vendor:publish --tag=couryo-config copies config/couryo.php to your app.

The transport is a regular Symfony Mailer transport, so it also works outside Laravel: new Symfony\Component\Mailer\Mailer(new Couryo\Laravel\CouryoTransport($couryo)).

Or plain SMTP

No package needed, with Laravel's smtp mailer:

Ports 587 and 2525 use STARTTLS, 465 uses TLS. The password is an API key with the send or admin scope.

PSR-18 client instead of curl

Needs psr/http-client and psr/http-factory. PSR-18 has no per-request timeout, so set it on your client. You can also write your own Couryo\Http\Transport (one send() method).

Everything else

Resource Methods
emails send, batch (up to 100), check, get, list, iterate
domains list, create, get, delete, verify, health (deliverability diagnosis)
webhooks list, create, get, update, delete
suppressions list, add, remove
events list, iterate (delivery events), track (contact event)
templates list, create, get, update, delete, versions, preview
contacts create (upsert), list, get, update, delete, iterate, count
campaigns create, list, get, update, delete, preflight, send, schedule, pause, resume, cancel, test, stats

iterate walks every page: foreach ($couryo->emails->iterate(['status' => 'bounced']) as $email) { ... }.

Options: api_key, base_url, max_retries (2), timeout (30 s per attempt), language, transport, sleep.

Docs: https://couryo.com/en/docs


All versions of couryo-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
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 couryo/couryo-php contains the following files

Loading the files please wait ...