rvalitov / mailslurp-php
MailSlurp PHP SDK for testing emails.
Requires
- php: >=7.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- phpunit/phpunit: ^6
This package is auto-updated.
Last update: 2025-01-08 08:15:45 UTC
README
⚠️ The MailSlurp has now official PHP client, use it https://packagist.org/packages/mailslurp/mailslurp-client-php
So this repository is archived.
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
- There is an official Javascript SDK available on npm.
- This PHP version was generated from swagger JSON definition using swagger-codegen and adapted for use with PHP 7.0+ (see commits for a full list of changes).
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
Documentation For Models
- AccountDto
- AccountsDto
- ApiReponse
- ApiReponseInboxDto_
- ApiReponseListEmailDto_
- ApiReponseListInboxDto_
- EmailDto
- InboxDto
- SendEmailDto
- UserDto
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