bernardinosousa/egoi-laravel

E-goi/sdk-php Wrapper for 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

Created this package on my free time to improve developer experience using Laravel/E-goi
I´m not affilied to E-goi

Installation

You can install the package via composer:

composer require bernardinosousa/egoi-laravel

You can publish the config file with:

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

Add to .env file:

EGOI_API_KEY="YOUR_API_KEY"

Usage

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

If you would like to have more examples, see E-goi sdk-php endpoints

Todo

  • 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

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.