PHP code example of liliom / laravel-zoho-campaigns

1. Go to this page and download the library: Download liliom/laravel-zoho-campaigns 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/ */

    

liliom / laravel-zoho-campaigns example snippets


'providers' => [
    ...
    Liliom\Zoho\Campaigns\CampaignsServiceProvider::class,
    ...
];

'aliases' => [
    ...
    'Campaigns' => Liliom\Zoho\Campaigns\CampaignsFacade::class,
    ...
],

    /**
     * @param string   $sort      [asc/desc]
     * @param int|null $fromIndex values are in number.
     * @param int|null $range     values are in number.
     *
     * @return object
     */
    public function getMailingLists(
        string $sort = 'desc',
        int $fromIndex = null,
        int $range = null
    ): object;

    /**
     * @param string   $listKey    List Key to send a subscription mail to contacts.
     * @param string   $filterType sentcampaigns,scheduledcampaigns,recentcampaigns.
     * @param int|null $fromIndex  values are in number.
     * @param int|null $range      values are in number.
     *
     * @return object
     */
    public function getListAdvancedDetails(
        string $listKey,
        string $filterType = 'sentcampaigns',
        int $fromIndex = null,
        int $range = null
    ): object;

    /**
     * @param string   $listKey   List Key to send a subscription mail to contacts.
     * @param string   $status    [active/recent/most recent/unsub/bounce].
     * @param string   $sort      [asc/desc]
     * @param int|null $fromIndex values are in number.
     * @param int|null $range     values are in number.
     *
     * @return object
     */
    public function getListSubscribers(
        string $listKey,
        string $status = 'active',
        string $sort = 'desc',
        int $fromIndex = null,
        int $range = null
    ): object;

    /**
     * @param string $type xml (or) json
     *
     * @return array
     */
    public function getAllSubscriberFields(
        string $type
    ): array;

    /**
     * @param string $listKey List Key to send a subscription mail to contacts.
     * @param int    $cvId    You will get cvid from @method getMailingLists().
     *
     * @return object
     */
    public function getSegmentDetails(
        string $listKey,
        int $cvId
    ): object;

    /**
     * @param int $cvId You will get cvid from @method getMailingLists().
     *
     * @return object
     */
    public function getSegmentContacts(
        int $cvId
    ): object;

    /**
     * @param string $listKey     List Key to send a subscription mail to contacts.
     * @param string $newListName Give list name.
     * @param string $signUpForm  [public/private]
     *
     * @return object
     */
    public function updateListDetails(
        string $listKey,
        string $newListName,
        string $signUpForm = 'public'
    ): object;

    /**
     * @param string $listKey        List Key to send a subscription mail to subscribers.
     * @param string $deleteContacts [on/off]
     *
     * @return object
     */
    public function deleteMailingList(
        string $listKey,
        string $deleteContacts = 'off'
    ): object;

    /**
     * @param string $listKey List Key to send a subscription mail to subscribers
     * @param string $status  [active|unsub|bounce|spam]
     *
     * @return object
     */
    public function listSubscribersCount(
        string $listKey,
        string $status = 'active'
    ): object;

    /**
     * @param string $listKey     List Key to send a subscription mail to subscribers
     * @param string $contactInfo Provide email id to be moved to Do-Not-Mail registry.
     * @param null   $sources     Subscriber source can be added.
     *
     * @return object
     */
    public function listSubscribe(
        string $listKey,
        string $contactInfo,
        $sources = null
    ): object;

    /**
     * @param string $listKey     List Key to send a subscription mail to subscribers
     * @param string $contactInfo Provide email id to be moved to Do-Not-Mail registry.
     *
     * @return object
     */
    public function listUnsubscribe(
        string $listKey,
        string $contactInfo
    ): object;

    /**
     * @param string $contactInfo Provide email id to be moved to Do-Not-Mail registry.
     *
     * @return object
     */
    public function contactDoNotMail(
        string $contactInfo
    ): object;

    /**
     * @param string $listKey  List Key to send a subscription mail to subscribers
     * @param string $emailIds Provide maximum of ten (10) EMAILID's comma (,) separately.
     *
     * @return object
     */
    public function addListSubscribersInBulk(
        string $listKey,
        string $emailIds
    ): object;

    /**
     * @param string $emailIds        Provide maximum of ten (10) EMAILID's comma (,) separately.
     * @param string $listName        Provide your list name.
     * @param string $signUpForm      [public/private]
     * @param string $mode            'newlist'
     * @param string $listDescription Provide a description for your list.
     *
     * @return object
     */
    public function addListAndContacts(
        string $emailIds,
        string $listName,
        string $signUpForm = 'public',
        string $mode = 'newlist',
        string $listDescription = ''
    ): object;

    /**
     * @param string $fieldName   Alphanumeric
     * @param string $fieldType   [Text|Integer|Phone|Date|Picklist|Email|Checkbox|LongInteger|URL|textarea|RadioOption|Multiselect|DateTime|Decimal|Percent]
     * @param int    $fieldLength This lets you to set length of the field. Default value is 20.
     * @param string $type        xml (or) json
     *
     * @return object
     */
    public function addCustomField(
        string $fieldName,
        string $fieldType,
        int $fieldLength = 20,
        string $type = 'json'
    ): object;

    /**
    * @param string $tagType     Custom
    * @param string $fieldName   Alphanumeric
    * @param string $fieldType   [Text|Integer|Phone|Date|Picklist|Email|Checkbox|LongInteger|URL|textarea|RadioOption|Multiselect|DateTime|Decimal|Percent]
    * @param string $mailValue   Give a default value for the tag to be used in email content.
    * @param string $socialValue Give a default value for the tag to be used in email content of social campaigns.
    * @param string $type        xml (or) json
    *
    * @return object
    */
    public function createMergeTag(
        string $tagType,
        string $fieldName,
        string $fieldType,
        string $mailValue = '',
        string $socialValue = '',
        string $type = 'json'
    ): object;

\Campaigns::async(true) // async calls on, default value is true
\Campaigns::async(false) // async calls off


// Later you can append the callback() to be executed when the response returns.
\Campaigns::async()->callback(Callable $requestCallback) 


// To test credentials and make sure the Auth Token is configured correctly. 
\Campaigns::testCredentials();