Download the PHP package mailhive/mailhive-php without Composer

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

mailhive/mailhive-php

The official PHP SDK for Mailhive Send. It needs PHP 8.1+ and only ext-curl and ext-json. It includes a Laravel mail driver.

Send an email

The keys match the API reference exactly: cc, bcc, reply_to, headers, tags, template_id, variables and attachments.

An attachment's content is the raw file, which is encoded for you. Use content_base64 if your data is already base64:

The accepted email's rejected maps any address dropped before sending to why it can't work (domain_typo, domain_not_found, no_mail_server, invalid_syntax); such addresses never bounce.

Check addresses before sending

Run the same checks on a form, while the person can still fix the typo. Nothing is sent or stored:

Audiences and contacts

With an API key that has Full access, keep an audience in step with your app or CRM:

upsert adds the person, or updates them if they're already there, so it's safe to repeat. Other calls: audiences->list, audiences->create, audiences->rename, contacts->list (pass ['email' => …] to find one person), contacts->add, contacts->upsertBatch (up to 100; check each result's ok), contacts->get, contacts->update, contacts->unsubscribe and contacts->delete.

Someone who unsubscribed, or reported your email as spam, can't be subscribed again by your code: you get a ConflictException with code contact_unsubscribed. To bring them back, ask them to confirm:

They're pending, and never mailed by a broadcast, until they click the link. See the contacts API reference.

Laravel

The package registers itself. Add the key and the mailer:

Every Mailable and notification then sends through Mailhive, including attachments, cc, bcc and Reply-To. A Mailable's tags and metadata become Mailhive tags. To make a send safe to repeat, add an X-Mailhive-Idempotency-Key header:

You can also type-hint the client anywhere: public function __construct(private \Mailhive\Mailhive $mailhive) {}.

Plain Symfony apps can use new \Mailhive\Laravel\MailhiveTransport($client) as a Symfony Mailer transport.

Retries and idempotency

Every send carries an Idempotency-Key. Retries reuse it, so a retry never sends twice.

To stay safe across restarts, pass your own key:

Errors

Exception Status
AuthenticationException 401
BillingException 402
PermissionException 403
NotFoundException 404
ConflictException 409
ValidationException 422
RateLimitException 429
ApiException other statuses, and the base class of all of the above
ConnectionException no response

All of them extend MailhiveException. Use errorCode() for Mailhive's code: PHP reserves getCode() for the HTTP status.

Webhooks

Options

Test keys (mhs_test_…) work unchanged: delivery is simulated and nothing is billed.

This package is published from the mailhive-sdks monorepo. Please open issues and pull requests there.

Releasing (maintainers)

  1. Bump Mailhive::VERSION, then merge to main in mailhive-sdks.
  2. Push the tag php-vX.Y.Z there.
  3. The split-php workflow mirrors php/ to Naszat/mailhive-php and tags it vX.Y.Z. Packagist then picks it up.

Without the PHP_MIRROR_DEPLOY_KEY secret, run the same steps from a checkout of main:


All versions of mailhive-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 mailhive/mailhive-php contains the following files

Loading the files please wait ...