PHPackages                             railsware/mailtrap-php - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. railsware/mailtrap-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

railsware/mailtrap-php
======================

The Mailtrap SDK provides methods for all API functions.

3.12.0(3w ago)58879.6k↓56.6%16MITPHPPHP ^8.0CI passing

Since Mar 28Pushed 5d ago14 watchersCompare

[ Source](https://github.com/mailtrap/mailtrap-php)[ Packagist](https://packagist.org/packages/railsware/mailtrap-php)[ Docs](https://github.com/railsware/mailtrap-php)[ RSS](/packages/railsware-mailtrap-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (26)Versions (45)Used By (0)

Mailtrap PHP client - Official
==============================

[](#mailtrap-php-client---official)

[![GitHub Actions](https://github.com/railsware/mailtrap-php/actions/workflows/ci-phpunit.yml/badge.svg)](https://github.com/railsware/mailtrap-php/actions/workflows/ci-phpunit.yml/badge.svg)[![GitHub Actions](https://github.com/railsware/mailtrap-php/actions/workflows/ci-psalm.yaml/badge.svg)](https://github.com/railsware/mailtrap-php/actions/workflows/ci-psalm.yaml/badge.svg)

[![PHP version support](https://camo.githubusercontent.com/0ce9a12c2b7968306b8c0e3b333d86131bfd4a87fa4369a2f339f109cda37d1f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7261696c73776172652f6d61696c747261702d7068702f7068703f7374796c653d666c6174)](https://packagist.org/packages/railsware/mailtrap-php)[![Latest Version on Packagist](https://camo.githubusercontent.com/34ae068c6e5aefa14a0364ddd6c84c007d395d96ba3ee47a27b355f0b185ae3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7261696c73776172652f6d61696c747261702d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/railsware/mailtrap-php)[![Total Downloads](https://camo.githubusercontent.com/ac985414c55519a475f430f8da1f8ebb858c8ed994772a190a905082b84fe76a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7261696c73776172652f6d61696c747261702d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/railsware/mailtrap-php)

Prerequisites
-------------

[](#prerequisites)

To get the most of this official Mailtrap.io PHP SDK:

- [Create a Mailtrap account](https://mailtrap.io/signup)
- [Verify your domain](https://mailtrap.io/sending/domains)

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

[](#installation)

You can install the package via [composer](http://getcomposer.org/)

The Mailtrap API Client is not hard coupled to Guzzle, React, Zend, Symfony HTTP or any other library that sends HTTP messages. Instead, it uses the [PSR-18](https://www.php-fig.org/psr/psr-18/) client abstraction.

This will give you the flexibility to choose what [HTTP client](https://docs.php-http.org/en/latest/clients.html) you want to use.

If you just want to get started quickly you should run one of the following command (depends on which HTTP client you want to use):

```
# With symfony http client (recommend)
composer require railsware/mailtrap-php symfony/http-client nyholm/psr7

# Or with guzzle http client
composer require railsware/mailtrap-php guzzlehttp/guzzle php-http/guzzle7-adapter
```

Framework integration
---------------------

[](#framework-integration)

If you use a framework, install a bridge package for seamless configuration:

- [Symfony](src/Bridge/Symfony)
- [Laravel](src/Bridge/Laravel)

These provide service registration and allow you to inject the client where needed with minimal manual bootstrapping.

Usage
-----

[](#usage)

You should use Composer autoloader in your application to automatically load your dependencies.

### Minimal usage (Transactional sending)

[](#minimal-usage-transactional-sending)

The quickest way to send a single transactional email with only the required parameters:

```
