Skip to content

Repository files navigation

Mailium Oauth Client for PHP

Latest Stable VersionMonthly DownloadsLicenseBuild Status

Mailium Oauth Client provides easy to use wrappers for authorizing your application and getting the tokens required to talk to the API.

Example application

An example application can be found under example directory.

This is a simple working application that utilizes most of the features of the client.

Quick Start

First, let's install the library with composer:

 composer require mailium/oauth-client-php

Initialize the client with your client_id and client_secret

$oauthClient = newMailiumOauthClient();
$oauthClient->setClientID("YOUR_CLIENT_ID");
$oauthClient->setClientSecret("YOUR_CLIENT_SECRET");
$oauthClient->setRedirectUri("YOUR_REDIRECT_URI");
// Scopes that your application need$oauthClient->addScope(MailiumOauthClient::SCOPE_BASIC);
$oauthClient->addScope(MailiumOauthClient::SCOPE_CAMPAIGN_READ);
$oauthClient->addScope(MailiumOauthClient::SCOPE_SUBSCRIBER_LIST_READ);
// Set the callback method to store the oauth token$oauthClient->setTokenStoreCallbackFunction("storeToken");

Creating authorization URL

$authorizationUrl = $oauthClient->createAuthorizationUrl();

Getting the tokens after receiving the authorization code

$oauthClient->authorize($authorizationCode);

Getting Resource Owner

$oauthClient->getResourceOwner();

About

Mailium oauth client for PHP

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages