Download the PHP package alexandresalome/mailcatcher without Composer
On this page you can find all versions of the php package alexandresalome/mailcatcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alexandresalome/mailcatcher
More information about alexandresalome/mailcatcher
Files in alexandresalome/mailcatcher
Package mailcatcher
Short Description A library to access MailCatcher
License MIT
Informations about the package mailcatcher
MailCatcher for PHP
Integrates MailCatcher in your PHP application.
- View CHANGELOG
- View CONTRIBUTORS
MailCatcher is a simple SMTP server with an HTTP API, and this library aims to integrate it to make it easy to use it with PHP.
Behat extension
This library provides a Behat extension to help you test mails in your application.
To use it, you first need to be sure MailCatcher is properly installed and running. You can use docker to execute it:
First, configure in your behat.yml
:
Then, add the MailCatcherContext context in your FeatureContext file:
Available steps
This extension provides you mail context in your tests. To use assertions, you must first open a mail using criterias.
Once it's opened, you can make assertions on it and click in it.
Server manipulation
Deletes all messages on the server
- When I purge mails
Mail opening
- When I open mail from "[email protected]"
- When I open mail containing "a message"
- When I open mail to "[email protected]"
- When I open mail with subject "Welcome, mister Bond!"
Assertion
Verify number of messages sent to the server:
- Then 1 mail should be sent
- Then 13 mails should be sent
Verify text presence in message:
- Then I should see "something" in mail
- Then I should see "something else" in mail
Verify text presence in mail without opening:
- Then I should see mail from "[email protected]"
- Then I should see mail containing "a message"
- Then I should see mail to "[email protected]"
- Then I should see mail with subject "Welcome, mister Bond!"
Custom mailcatcher context
Only available from PHP 5.4
If you want to create a context class that relates to MailCatcher, you can use the MailCatcherTrait to get the mailcatcher client injected inside your class:
This trait offers the following methods:
- getMailCatcherClient(): returns the mailcatcher Client instance.
- findMail($criteria, $value): facility to search for a given message, or throws an exception if not found
Don't forget to implement the MailCatcherAwareInterface to get the mailcatcher client injected inside your context class.
Client API
Browse easily your API with the integrated SDK:
Message API
Attachment API
All versions of mailcatcher with dependencies
ext-json Version *
symfony/dom-crawler Version ~2.3 || ~3.0 || ~4.0 || ~5.0 || ~6.0 || ~7.0