PHP code example of ahmedsamy / hype-mailchimp-bundle

1. Go to this page and download the library: Download ahmedsamy/hype-mailchimp-bundle 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/ */

    

ahmedsamy / hype-mailchimp-bundle example snippets

 bash
$ php composer.phar update "ahmedsamy/hype-mailchimp-bundle"
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Hype\MailchimpBundle\HypeMailchimpBundle(),
    );
}
 php

        $mailchimp = $this->get('hype_mailchimp');
 php
 
    $mc = $this->get('hype_mailchimp');
        $data = $mc->getCampaign()->create('regular', array(
            'list_id' => '93419bbdc0',
            'subject' => 'test created subject',
            'from_email' => '[email protected]',
            'from_name' => 'Ahmed Samy',
            'to_name' => 'fans'
                ), array(
            'html' => '<h5>Html content</h5>',
            'sections' => array(),
            'text' => 'test',
            'url' => 'http://www.example.com',
            'archive' => 'test'
        ));
        var_dump($data);
 php
 
     $mc = $this->get('hype_mailchimp');
     $data = $mc->getCampaign()
                ->setCi('1088b4ed65')
                ->del();

        var_dump($data);
 php
 
     $mc = $this->get('hype_mailchimp');
     $data = $mc->getCampaign()
                ->setCi('1088b4ed65')
                ->send();

        var_dump($data);
 php
 
     $mc = $this->get('hype_mailchimp');
     $data = $mc->getList()
                ->subscribe('[email protected]');
        var_dump($data);
 php
 
     $mc = $this->get('hype_mailchimp');
     $data = $mc->getList()
                ->setListId('xxxxxxx')
                ->addMerge_vars(
                        array(
                            'mc_notes' => 'test notes'
                ))
                ->subscribe('[email protected]');