The PHP Dev Docs provide info for devs.

Learn how to send and receive emails and SMS in your PHP application with MailSlurp. Check out our quicklinks and basic usage guide today!

  • Table of contents

This page has moved.

MailSlurp enables the sending and receiving of emails and SMS in any PHP application.

Install MailSlurp packages

If you use the composer package manager you can run

composer require mailslurp/mailslurp-client-php

Or add it to your composer.json file:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/mailslurp/mailslurp-client-php.git"
    }
  ],
  "require": {
    "mailslurp/mailslurp-client-php": "*@dev"
  }
}

Basic usage (creating an email address)

To create a new email address use the inbox controller:

<?php
public function test_canCreateInboxes(): void
{
    // create an inbox controller with config
    $inboxController = new MailSlurpApisInboxControllerApi(null, $this->config);

    // create inbox
    $inbox = $inboxController->createInbox();

    // assert on properties
    $this->assertNotNull($inbox->getId());
    $this->assertStringContainsString("@mailslurp.com", $inbox->getEmailAddress());
}

Create a free account

Sign up for an account and create an API Key to for use with your client. See the getting started page for more information.