Download the PHP package mailcapture/mailcapture-php without Composer

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

mailcapture-php

Official PHP SDK for MailCapture — a real email capture API for integration testing OTP codes, verification links, and other transactional emails.

MailCapture captures emails sent by your application during testing. Give each test a unique address, trigger your email flow, then use this SDK to retrieve and assert on what arrived — subject lines, body text, OTP codes, and more. Works with PHPUnit, Pest, or any other PHP test framework.

A MailCapture account is required — free and paid plans are available. Sign up at mailcapture.app.

Requirements

Installation

Quick start

The pattern for integration tests

API reference

new MailCapture($apiKey, ...)


ping()PingResult

Validates your API key and returns your address template. Caches your username so address() works without a network call.


waitFor(tag, timeout, pollTimeout, after)Capture

Long-polls the API and returns the first email captured for the given tag. The server holds the connection open — no busy-waiting.

Throws MailCaptureTimeoutException if no email arrives in time.


inbox(tag)Inbox

Returns a scoped Inbox for a tag. Keeps test code clean.


address(tag)string

Generates the capture email address synchronously. Requires ping() first (or username in the constructor).


list(tag, limit, after)CaptureList

Lists recent captures (newest first).


get(captureId)Capture

Get a single capture by ID. Throws MailCaptureNotFoundException if not found.


delete(tag)void

Deletes all captures for a tag. Use in setUp() for test isolation.


The Capture object

The otp field is extracted automatically. If your OTP is embedded in a sentence, the service finds it for you.


Exception handling

All exceptions extend MailCaptureException extends \RuntimeException and have getErrorCode().

Exception getErrorCode() When
MailCaptureAuthException UNAUTHORIZED Invalid or revoked API key
MailCaptureTimeoutException TIMEOUT waitFor exceeded timeout
MailCaptureNotFoundException NOT_FOUND get() — capture not found
MailCaptureNetworkException NETWORK_ERROR Could not reach the API
MailCaptureApiException varies Unexpected API error

Testing with a mock HTTP client

Inject a Guzzle mock client to test your code without hitting the real API:


Laravel / Symfony integration


Local development


All versions of mailcapture-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
guzzlehttp/guzzle Version ^7.0
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 mailcapture/mailcapture-php contains the following files

Loading the files please wait ...