PHP code example of bonsi / laravel-newsletter-getresponse

1. Go to this page and download the library: Download bonsi/laravel-newsletter-getresponse library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bonsi / laravel-newsletter-getresponse example snippets


Newsletter::subscribe('[email protected]');

Newsletter::unsubscribe('[email protected]');

//Merge variables can be passed as the second argument
Newsletter::subscribe('[email protected]', ['firstName'=>'Sam', 'lastName'=>'Vines']);

//Subscribe someone to a specific list by using the third argument:
Newsletter::subscribe('[email protected]', ['firstName'=>'Nanny', 'lastName'=>'Ogg'], 'Name of your list');

//Get some member info, returns an array described in the official docs
Newsletter::getMember('[email protected]');

//Returns a boolean
Newsletter::hasMember('[email protected]');

//If you want to do something else, you can get an instance of the underlying API:
Newsletter::getApi();

// config/app.php
'providers' => [
    ...
    Bonsi\GetResponse\Newsletter\NewsletterServiceProvider::class,
    ...
];

// config/app.php
'aliases' => [
    ..
    'Newsletter' => Bonsi\GetResponse\Newsletter\NewsletterFacade::class,
];

return [

        /*
         * The api key of a GetResponse account. You can find yours here:
         * https://us10.admin.mailchimp.com/account/api-key-popup/
         */
        'apiKey' => env('GETRESPONSE_APIKEY'),

        /*
         * When not specifying a listname in the various methods,
         *  this list name will be used.
         */
        'defaultListName' => 'subscribers',

        /*
         * Here you can define properties of the lists you want to
         * send campaigns.
         */
        'lists' => [

            /*
             * This key is used to identify this list. It can be used
             * in the various methods provided by this package.
             *
             * You can set it to any string you want and you can add
             * as many lists as you want.
             */
            'subscribers' => [

                /*
                 * A getresponse campaign id. Check the mailchimp docs if you don't know
                 * how to get this value:
                 * http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id
                 */
                 'id' => env('GETRESPONSE_DEFAULT_LIST_ID'),
            ],
        ],
];

use Newsletter;

use Newsletter;

Newsletter::subscribe('[email protected]');

Newsletter::unsubscribe('[email protected]');

Newsletter::subscribe('[email protected]', ['firstName'=>'Rince', 'lastName'=>'Wind']);

Newsletter::subscribe('[email protected]', ['firstName'=>'Rince', 'lastName'=>'Wind'], 'subscribers');

Newsletter::unsubscribe('[email protected]', 'subscribers');

Newsletter::getMember('[email protected]');

Newsletter::hasMember('[email protected]'); //returns a bool

/**
 * @param string $fromName
 * @param string $replyTo
 * @param string $subject
 * @param string $html
 * @param string $listName
 * @param array  $options
 * @param array  $contentOptions
 *
 * @return array|bool
 *
 * @throws \Bonsi\GetResponse\Newsletter\Exceptions\InvalidNewsletterList
 */
public function createCampaign($fromName, $replyTo, $subject, $html = '', $listName = '', $options = [], $contentOptions = [])

Newsletter::getLastError();

Newsletter::lastActionSucceeded();

$api = Newsletter::getApi();
bash
php artisan vendor:publish --provider="Bonsi\GetResponse\Newsletter\NewsletterServiceProvider"