php-extended/php-tempmail-org-api

This package is abandoned and no longer maintained. The author suggests using the php-extended/php-api-org-tempmail-object package instead.

A php API wrapper to connect to temp-mail.org API

3.1.8 2021-01-31 22:27 UTC

This package is auto-updated.

Last update: 2023-07-15 14:51:14 UTC


README

A php API wrapper to connect to temp-mail.org API.

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-tempmail-org-api": "^3",
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

For the basic functions, use :


use PhpExtended\TempMailOrgApi\TempMailOrgApiEndpoint;

/* @var $client         \Psr\Http\Client\ClientInterface */          // psr-18
/* @var $uriFactory     \Psr\Http\Message\UriFactoryInterface */     // psr-17
/* @var $requestFactory \Psr\Http\Message\RequestFactoryInterface */ // psr-17

$endpoint = new TempMailOrgApiEndpoint($client, $uriFactory, $requestFactory);

$emailMds = $endpoint->getemailMds('siracoy954@box4mls.com');

foreach($emailMds as $emailMd)
{
	/* @var $emailMd \PhpExtended\TempMailOrgApi\TempMailOrgApiemailMd */
	/* @var $email         \PhpExtended\TempMailOrgApi\TempMailOrgApiemailMd */
	$email = $endpoint->getEmailFromId($emailMd->getMailAddressId());
	
	// do stgh with the mail data : $email->getMailText(); and $email->getMailText();
	
	$attachmentMds = $emailMd->getMailAttachments();
	foreach($attachmentMds as $attachmentMd)
	{
		/* @var $attachmentMd \PhpExtended\TempMailOrgApi\TempMailOrgApiAttachmentMetadata */
		/* @var $attachment   \PhpExtended\TempMailOrgApi\TempMailOrgApiAttachment */
		$attachment = $endpoint->getEmailAttachmentFromIds($emailMd->getMailAddressId(), $attachmentMd->getId());
		
		// do stgh with the attachment raw data : $attachment->getContent();
	}
}

For the packages that are useful at getting http requests (ClientInterface), see the require-dev of the composer.json file.

License

MIT (See license file).