php-extended/php-tempmail-org-api

此包已废弃,不再维护。作者建议使用 php-extended/php-api-org-tempmail-object 包。

用于连接到 temp-mail.org API 的 php 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

用于连接到 temp-mail.org API 的 php API 封装器。

coverage build status

安装

此库的安装通过 composer 完成。从 他们的网站 下载 composer.phar。然后将以下内容添加到您的 composer.json 中:

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

然后运行 php composer.phar update 来安装此库。此库中所有类的自动加载都通过 composer 的自动加载器完成。

基本用法

对于基本功能,使用


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();
	}
}

有关获取 http 请求(ClientInterface)的实用包,请参阅 composer.json 文件的 require-dev 部分。

许可协议

MIT(见 许可文件)。