bernardinosousa/egoi-laravel

E-goi/sdk-php 的 Laravel 封装

v1.0 2023-01-20 00:26 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

在空闲时间创建此包以提高使用 Laravel/E-goi 的开发者体验
我不是 E-goi 的附属

安装

您可以通过 composer 安装此包

composer require bernardinosousa/egoi-laravel

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="egoi-laravel-config"

添加到 .env 文件

EGOI_API_KEY="YOUR_API_KEY"

用法

use Bernardinosousa\EgoiLaravel\Facades\EgoiLaravel;

//Get All Contacts from List
try {
    $listId = 1;

    $contactListResponse = EgoiLaravel::api('contacts')->getAllContacts(
        $listId
    );

    dump($contactResponse);
} catch (\Exception $e) {
    dump('Exception when getting all contacts from list: ', $e->getMessage());
}

//Get Contact Information from List Id and Contact Id
try {
    $listId = 1;

    $contactId = "f51f0117ba";

    $contactResponse = EgoiLaravel::api('contacts')->getContact(
        $contactId, 
        $listId
    );

    dump($contactResponse);
} catch (\Exception $e) {
    dump('Exception when getting contact information: ', $e->getMessage());
}

//Create Contact from List
try {
    $contactBaseExtraPost = new \EgoiClient\EgoiModel\ContactBaseExtraPost([
        'base' => [
            "status" => "active",
            "first_name" => "John",
            "last_name" => "Doe",
            "birth_date" => "1975-01-10",
            "language" => "en",
            "email" => "example@e-goi.com",
            //"cellphone" => "351-300404336",
            //"phone" => "351-300404336",
            "push_token_android" => [],
            "push_token_ios" => []
        ]
    ]);

    $listId = 1;

    $contactResponse = EgoiLaravel::api('contacts')->createContact(
        $listId, 
        $contactBaseExtraPost
    );

    dump($contactResponse);
} catch (\Exception $e) {
    dump('Exception when creating contact from list: ', $e->getMessage());
}

如果您想了解更多示例,请参阅 E-goi sdk-php 端点

待办事项

  • AdvancedReportsApi
  • AutomationsApi
  • CNamesApi
  • CampaignGroupsApi
  • CampaignsApi
  • ConnectedSitesApi
  • EcommerceApi
  • EcommerceActivityApi
  • EmailApi
  • FieldsApi
  • ListsApi
  • MyAccountApi
  • OperationsApi
  • PingApi
  • PushApi
  • ReportsApi
  • SegmentsApi
  • SendersApi
  • SmartSmsApi
  • SmsApi
  • SuppressionListApi
  • TagsApi
  • TrackEngageApi
  • UsersApi
  • UtilitiesApi
  • VoiceApi
  • WebHooksApi
  • WebpushApi

测试

composer test

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全漏洞

请查看 我们的安全策略 了解如何报告安全漏洞。

致谢

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件