Download the PHP package railsware/mailtrap-php without Composer
On this page you can find all versions of the php package railsware/mailtrap-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mailtrap-php
Mailtrap PHP client - Official
Prerequisites
To get the most of this official Mailtrap.io PHP SDK:
Installation
You can install the package via composer
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 client abstraction.
This will give you the flexibility to choose what HTTP client 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):
Framework integration
If you use a framework, install a bridge package for seamless configuration:
- Symfony
- Laravel
These provide service registration and allow you to inject the client where needed with minimal manual bootstrapping.
Usage
You should use Composer autoloader in your application to automatically load your dependencies.
Minimal usage (Transactional sending)
The quickest way to send a single transactional email with only the required parameters:
Sandbox vs Production (easy switching)
Mailtrap lets you test safely in the Email Sandbox and then switch to Production (Sending) with one flag.
Example .env variables (or export in shell):
Bootstrap logic:
Bulk stream example (optional) differs only by setting isBulk: true:
Recommendations:
- Toggle sandbox with
MAILTRAP_USE_SANDBOX. - Use separate API tokens for Production and Sandbox.
- Keep initialisation in a single factory object/service so that switching is centralised.
Full-featured usage example
Supported functionality & Examples
Email API:
- Send an email (Transactional stream) –
sending/minimal.php - Send an email (Bulk stream) –
bulk/bulk.php - Send an email with a Template (Transactional) –
sending/template.php - Send an email with a Template (Bulk) –
bulk/bulk_template.php - Batch send (Transactional) –
batch/transactional.php - Batch send (Bulk) –
batch/bulk.php - Batch send with Template (Transactional) –
batch/transactional_template.php - Batch send with Template (Bulk) –
batch/bulk_template.php - Sending domain management CRUD –
sending-domains/all.php - Suppressions (find & delete) –
sending/suppressions.php - Email Logs (list & get by message ID) –
sending/email-logs.php
Email Sandbox (Testing):
- Send an email (Sandbox) –
testing/send-mail.php - Send an email with a Template (Sandbox) –
testing/template.php - Batch send (Sandbox) –
batch/sandbox.php - Batch send with Template (Sandbox) –
batch/sandbox_template.php - Message management CRUD –
testing/messages.php - Inbox management CRUD –
testing/inboxes.php - Project management CRUD –
testing/projects.php - Attachments operations –
testing/attachments.php
Contact management:
- Contacts CRUD & listing –
contacts/all.php - Contact lists CRUD –
contact-lists/all.php - Custom fields CRUD –
contact-fields/all.php - Import/Export – (no example yet) ← add in future
- Events – (no example yet) ← add in future
General API:
- Templates CRUD –
templates/all.php - Billing info –
general/billing.php - Accounts info –
general/accounts.php - Permissions listing –
general/permissions.php - Users listing –
general/users.php
Framework-specific (quick starts):
- Laravel transactional send –
laravel/transactional.php - Laravel sandbox send –
laravel/sandbox.php - Laravel template send –
laravel/template.php - Laravel bulk send –
laravel/bulk.php - Symfony transactional send –
symfony/transactional.php - Symfony sandbox send –
symfony/sandbox.php - Symfony template send –
symfony/template.php - Symfony bulk send –
symfony/bulk.php
See the full indexed list at examples/README.md.
Webhooks:
- Verifying webhook signatures –
webhooks/verify_signature.php
Contributing
Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The package is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Mailtrap project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
All versions of mailtrap-php with dependencies
ext-curl Version *
ext-json Version *
psr/http-message Version ^1.0 || ^2.0
psr/http-client-implementation Version ^1.0
php-http/client-common Version ^2.0
php-http/httplug Version ^2.0
php-http/discovery Version ^1.0
symfony/mime Version ^6.0|^7.0|^8.0
egulias/email-validator Version ^2.1.10|^3.1|^4
psr/http-factory Version ^1.1