定制 / 改进mx
用于Laravel PHP的ImprovMX API客户端库
1.0.1
2021-01-29 20:12 UTC
Requires
- illuminate/support: ~7|~8
Requires (Dev)
- orchestra/testbench: ~5|~6
- phpunit/phpunit: ~9.0
This package is auto-updated.
Last update: 2024-09-29 05:56:17 UTC
README
此存储库包含用于ImprovMX API的Laravel客户端库的源代码。
安装
此版本支持PHP 7.2-8.0。要开始使用,只需使用Composer将项目引入现有的Laravel应用程序中。
composer require bespoke/improvmx
如果您还没有安装composer,请按照以下安装说明操作。
该项目有一个服务提供者,在新版本的Laravel中将自动配置。
要使项目正常运行,只需将您的ImprovMX API密钥添加到您的.env文件中。
IMPROVMX_KEY=XXXXXXXXXXXXXX
入门指南
使用ImprovMX客户端的推荐方法是使用Laravel服务提供者访问它。
这将自动使用您的.env文件中的API密钥构造客户端。
$improvMx = new ImprovMx(); $client = $improvMx->client();
或者,可以手动构造一个ImprovMX客户端。
$client = new Bespoke\ImprovMX\Client("INPUT_API_KEY_MANUALLY");
客户端构造完成后,API可以按以下方式使用
$client->account()->getAccountDetails(); $client->domains()->list();
示例用法
账户
$improvMx = new ImprovMX(); // Return the Account entity. $accountDetails = $improvMx->client()->account()->getAccountDetails(); // Return a collection of white-labelled domains. $domains = $improvMx->client()->account()->getWhiteLabeledDomains();
域名
$improvMx = new ImprovMX(); // Return a collection of Domain entities. $domains = $improvMx->client()->domains()->list(); // Returns the newly created Domain entity or null (if failed to create). $improvMx->client()->domains()->add("domain.com", "email@email.com", "whitelabel-domain.com"); // Return the Domain entity (or null). $domain = $improvMx->client()->domains()->get("test.com"); // Update the details for a domain - returns the Domain entity or null. $improvMx->client()->domains()->update("domain.com", "email@email.com", "whitelabel-domain.com"); // Returns delete successful - true or false. $success = $improvMx->client()->domains()->delete("domain.com"); // Returns a RecordValidity entity. $details = $improvMx->client()->domains()->checkDomainValidity("domain.com");
别名
$improvMx = new ImprovMX(); // Return a collection of Alias entities for a domain. $aliases = $improvMx->client()->aliases()->list("domain.com"); // This command sets up email forwarding from user@domain.com to forward@email.com. // Returns the newly created Alias entity or null (if failed to create). $improvMx->client()->aliases()->add("domain.com", "user", "forward@email.com"); // Return the Alias entity (or null) for a given alias e.g. (alias@domain.com). $alias = $improvMx->client()->aliases()->get("domain.com", "alias"); // Update the forwarding address for an alias - returns the Alias entity or null. $improvMx->client()->aliases()->update("domain.com", "alias", "forward@email.com"); // Returns delete successful - true or false. $success = $improvMx->client()->aliases()->delete("domain.com", "alias");
日志
$improvMx = new ImprovMX(); // Return a collection of Log entities for a domain. $logs = $improvMx->client()->logs()->getDomainLogs("domain.com"); // Return a collection of Log entities for a domain's alias. $logs = $improvMx->client()->logs()->getAliasLogs("domain.com", "alias");
SMTP凭证
$improvMx = new ImprovMX(); // Return a collection of Credential entities for a domain. $credentials = $improvMx->client()->smtpCredentials()->list("domain.com"); // Add a new SMTP account for a domain (returns with the Credential entity or null). $logs = $improvMx->client()->smtpCredentials()->add("domain.com", "username", "password"); // Update the password for an SMTP account (by username) - returns the Credential entity or null. $improvMx->client()->smtpCredentials()->update("domain.com", "username", "newPassword"); // Returns delete successful - true or false. $success = $improvMx->client()->smtpCredentials()->delete("domain.com", "username");
安全
如果您在此包中发现安全漏洞,请发送电子邮件至Bespoke Technology Labs的hello@bespoke.dev。我们将迅速解决所有安全漏洞。您可以在此处查看我们的完整安全策略。
许可证
ImprovMX API客户端库根据MIT许可证(MIT)授权。
鸣谢
- Lewis Smallwood - Bespoke Technology Labs