Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Managesend Php Laravel Package

dreamcampaigns/managesend-php

PHP client library for the DreamCampaigns (Managesend) API. Authenticate with API key/secret and send transactional “Smart” emails via the REST client. Install with Composer or manually with the included autoloader. Supports PHP 5.3–7.4.

View on GitHub
Deep Wiki
Context7

managesend-php

Travis (.org) Packagist Packagist Version Packagist

A PHP library implementing the complete functionality of the DreamCampaigns API. A complete suites of marketing tools for your business or website.

Supported PHP Versions

This library supports the following PHP implementations:

  • PHP 5.3
  • PHP 5.4
  • PHP 5.5
  • PHP 5.6
  • PHP 7.0
  • PHP 7.1
  • PHP 7.2
  • PHP 7.3
  • PHP 7.4

Installation

You can install managesend-php via composer or by downloading the source.

Via Composer

managesend-php is available on Packagist as the dreamcampaigns/managesend-php package.

If you use Composer, you can run the following command from the root of your project to install:

composer require dreamcampaigns/managesend-php

Manual Installation

If youn't use Composer you can simply download the library and include it in your project.

After you have installed the library, if you need an autoloader, simply include the managesend-php autoload class, as follows:

require_once __DIR__ . '/../managesend-php/autoLoader/autoload.php';

Authenticating

The DreamCampaigns API uses Basic authentication using an API key and API secret.

Quickstart

Send a Smart email

// Send a Smart email using DreamCampaigns's REST API and PHP
<?php
$apiKey = "ACXXXXXX"; // Your Account/Client API Key from https://login.managesend.com/myaccount/apikeys
$apiSecret = "YXYXYX"; // Your Account/Client API Secret from https://login.managesend.com/myaccount/apikeys
$clientId = "a6hsgw74dw0001om4yrgfen8";

$restClient = new \Managesend\RestClient($apiKey, $apiSecret, $clientId);
$result = $restClient->transactional()->sendSmartEmail("c5is8tltkk00018k9ype5lg741",array(
    "toEmail"=>"joe@example.com",
    "toName"=>"Joe Smith",
    "data"=>array("promoCode"=>"XYZ"),
));
$newEmail = $result->getData();

//your IDE should auto generate all available getters for each call & results
print $newEmail->getMessageId();
print $newEmail->getStatus();

//or if you preffer arrays

print_r($newEmail->toArray());

//or you can get the response, where you can get all available data & headers as array

$response = $result->getResponse();

Send a Smart SMS

// Send a Dynamic SMS using DreamCampaigns's REST API and PHP
<?php
$apiKey = "ACXXXXXX"; // Your Account API Key from https://login.managesend.com/myaccount/apikeys
$apiSecret = "YXYXYX"; // Your Account API Secret from https://login.managesend.com/myaccount/apikeys

//if you are using your account level api keys you can set the client ids for each call.
$restClient = new \Managesend\RestClient($apiKey, $apiSecret);
$result = $restClient->setClientId("c5is8tltkk00018k9ype5lg741")->transactional()->sendDynamicSms("c5is8tltkk00018k9ype5lg741",array(
    "toNumber"=>"+1234567891",
    "content"=>"Hello Joe, your password has been reset.",
));
$newSms = $result->getData();

print $newEmail->getMessageId();

Getting sent email campaigns

<?php
$result = $restClient->emailCampaign()->getCampaignsSent();
$campaigns = $result->getData();
foreach ($campaigns as $campaign){
    print $campaign->getSentDate();
}

Using .env

If you're using .env, you can set your API credentials in your .env.

MANAGESEND_TOKEN_KEY=ACXXXXXX
MANAGESEND_TOKEN_SECRET=YXYXYX
MANAGESEND_CLIENT_ID=c5is8tltkk00018k9ype5lg741
<?php
$restClient = new \Managesend\RestClient();
$result = $restClient->lists()->getSubscriberList("joe@example.com");

Examples

Samples for creating or accessing all resources can be found in the examples directory.

Documentation

For more details you can reffer to the DreamCampaigns API documentations

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky