PHP code example of craftcodery / clicksend

1. Go to this page and download the library: Download craftcodery/clicksend 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/ */

    

craftcodery / clicksend example snippets


/**
 * Get the recipient's address for ClickSend mailers.
 *
 * @return array
 */
public function mailerRecipientAddress()
{
    return [
        'address_name'        => $this->name,
        'address_line_1'      => $this->address,
        'address_line_2'      => $this->address_2,
        'address_city'        => $this->city,
        'address_state'       => $this->state,
        'address_postal_code' => $this->postal_code,
        'address_country'     => $this->country,
    ];
}

/**
 * Get the sender's return address for ClickSend mailers.
 *
 * @return array
 */
public function mailerReturnAddress()
{
    return [
        'address_name'        => $this->name,
        'address_line_1'      => $this->address,
        'address_line_2'      => $this->address_2,
        'address_city'        => $this->city,
        'address_state'       => $this->state,
        'address_postal_code' => $this->postal_code,
        'address_country'     => $this->country,
    ];
}

$user->sendLetterTo($recipient, 'This is the content of the letter.');
$user->sendPostcardTo($recipient, 'https://example.com/postcard-image.pdf', 'This is the content on the rear of the postcard.');
bash
php artisan vendor:publish --provider="CraftCodery\ClickSend\ClickSendServiceProvider" --tag="migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="CraftCodery\ClickSend\ClickSendServiceProvider" --tag="config"