rvalitov/mailslurp-php

This package is abandoned and no longer maintained. The author suggests using the mailslurp/mailslurp-client-php package instead.

MailSlurp PHP SDK for testing emails.

0.0.1 2018-11-06 07:29 UTC

This package is auto-updated.

Last update: 2020-08-14 14:09:09 UTC


README

API Version PHP

MailSlurp-PHP

MailSlurp is an end-to-end email testing service. It has a web-app for managing your account and a REST API for sending and receiving emails from randomly generated email addresses.

Why?

MailSlurp was built to test the integration of email services within an app. If your application relies on the sending or receiving of emails, then MailSlurp will let you test that functionality. This is a more common need than you might think: if your app has a sign up process that requires email verification, how do you currently test that?

Getting started

Every API request requires a valid API Key appended as a query parameter. To obtain an API Key visit your account dashboard.

The general flow is as follows:

  • Create a new inbox during a test. The email address will be returned in the apiReponse.
  • Send an email to that address or trigger an action in your test that does so.
  • Fetch the email for your new inbox and check if its content is what you expected, or use the content in another action.

SDK

Legal

The Mailslurp API code is owned by PettmanUG and uses a proprietary software licence. The SDKs are free to use in any project and have an ISC licence.

Bugs, features, support

To report bugs or request features please see the contact page. For help see support.

Requirements

PHP 7.0 and later

Installation & Usage

Composer

To install the bindings via Composer, run command

composer require rvalitov/mailslurp-php

Or manually add the following to composer.json:

{
  "require": {
    "rvalitov/mailslurp-php": "^0.0.1"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/MailSlurp-PHP/vendor/autoload.php');

Tests

Note. Tests are not implemented yet!

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Swagger\Client\Api\AccountControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$jwt_token = "jwt_token_example"; // string | Cognito ID obtained during login
$stripe_token = "stripe_token_example"; // string | Stripe user payment confirmation token

try {
    $result = $apiInstance->createSubscriptionUsingPOST($jwt_token, $stripe_token);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AccountControllerApi->createSubscriptionUsingPOST: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://api.mailslurp.com

Class Method HTTP request Description
AccountControllerApi createSubscriptionUsingPOST POST /subscription Upgrade a user to paid
AccountControllerApi getAccountsUsingGET GET /accounts List available account types
InboxControllerApi createRandomInboxUsingPOST POST /inboxes Create an inbox
InboxControllerApi deleteInboxUsingDELETE DELETE /inboxes/{uuid} Delete an inbox
InboxControllerApi getEmailsForInboxUsingGET GET /inboxes/{uuid} Fetch emails for a given inbox
InboxControllerApi getListOfInboxesUsingGET GET /inboxes List your inboxes
InboxControllerApi sendEmailFromUserUsingPOST POST /inboxes/{uuid} Send an email
UserControllerApi getUserUsingGET GET /user Fetch a user

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Generation from Swagger

If you want to generate the original code from Swagger, use the following commands:

wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.3.1/swagger-codegen-cli-2.3.1.jar -O swagger-codegen-cli.jar
java -jar .\swagger-codegen-cli.jar generate -i https://api.mailslurp.com/v2/api-docs -l php -o ./out