Download the PHP package mailslurp/mailslurp-client-php without Composer

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

PHP Email and SMS API - Documentation

Create and manage email addresses and phone numbers in PHP. Send and receive emails, attachments, and SMS in code and tests. Here is a quick example:

Video tutorial

PHP mailslurp tutorial

Quick links

Examples

Get started

MailSlurp is an email API that lets you create email addresses on demand then send and receive emails in code and tests. No MailServer is required.

This section describes how to get up and running with the PHP client. To use another language or the REST API see the developer page.

See the examples page for code examples and use with common frameworks.

See the method documentation for a list of all functions.

Get an API Key

You need a free MailSlurp account to use the service. Sign up for a free account first.

Once signed up login your dashboard. Find your API Key and copy the code. You'll need this to configure the MailSlurp client in PHP.

find-api-key

Copy your API Key from the MailSlurp dashboard.

PHP Setup

The client is tested for PHP 7 and requires the following non-default PHP extensions to be installed:

Typically, these come with most PHP installations. On Linux they can also be installed like so:

sudo apt-get install php-ext-curl php-mbstring php-xml

Add PHP Library

There are several ways to install MailSlurp.

a) Composer dependency

If you use the composer package manager you can run:

Or add it to your composer.json file:

Then include the library with the composer autoload convention:

b) Manual installation

Alternatively you can download the PHP Library and include it in your project's root directory.

![php-email-library-github](https://www.mailslurp.com/assets/guides/php-download.png) Download the MailSlurp PHP email libraryMailSlurp dashboard.

Then include the files to have access to MailSlurp in your code:

Create an API instance

To call the MailSlurp API you must create an instance of the controller you wish to access. Each instance must be configured with an API Key. See method documentation for a list of all controllers and methods.

Configure the API Key

Create a controller

Basic usage

A common use case is to create a new email address, send it an email and then receive the contents:

Create an email address

To create an email address use the inbox controller to create a new inbox. Inboxes have real email addresses and can send and receive emails and attachments.

Send an email

Here is a simple example of sending an email:

Read an email

You can use the WaitFor controller methods to wait for an expected email to arrive in an inbox:

Then call it like so:

Fetch emails

You can get emails from an inbox using the inbox controller:

You can also fetch in paginated form:

Get an email

Get an email directly by ID using the email controller:

SMTP access (PHPMailer, mail function etc.)

SMTP inboxes provide IMAP and SMTP access credentials via the getImapSmtpAccess function. Use these to configure PHPMailer, PearMailer or other SMTP sending clients. First create an SMTP_INBOX:

Then use the access settings to configure PHPMailer:

List inboxes

Inbox lists are paginated.

Send an email with more options

To send an email first create an inbox. Then use the sendEmail method on the InboxController and pass it the sender inbox's ID and email options.

Attachments

Using attachments in PHP is easy. For sending attachments you must first upload each file and store the returned attachment IDs. For sending use these IDs with SendEmailOptions. Received email attachments can be downloaded using the EmailControllerApi.

To send the attachments use like so:

Receive an email

You can receive emails in PHP using MailSlurp. First create an inbox then call a waitFor method. These methods wait until a new unread email has arrived and return it.

Larger example:

Receive attachment

Test example:

Extract email content

You can use regex to parse codes or statements for email bodies like so:

SDK Documentation

For more functions and examples read the library documentation or see the PHP guides.


All versions of mailslurp-client-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.3
guzzlehttp/psr7 Version ^1.7 || ^2.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 mailslurp/mailslurp-client-php contains the following files

Loading the files please wait ....