1. Go to this page and download the library: Download uhin/laravel_api 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/ */
uhin / laravel_api example snippets
artisan uhin:make:rabbit-builder
public function __construct()
{
parent::__construct();
// You can overwrite these parent values
// $this->exchange = config('uhin.rabbit.exchange');
// $this->queue = config('uhin.rabbit.queue');
// $this->routingKey = config('uhin.rabbit.routing_key');
// $this->connectionName = 'default';
}
$templateId = config('mail.sendgrid.template.test');
$email = new SendGridTemplate($templateId);
// Send the email to user1, and CC user2 and user3
$metaDataA = new \SendGrid\Mail\Personalization();
$metaDataA->addDynamicTemplateData('sendgrid_var_1', 'custom data value 1');
$metaDataA->addDynamicTemplateData('sendgrid_var_2', 'custom data value 2');
$metaDataA->addCc(new \SendGrid\Mail\Cc('[email protected]', 'User 2'));
$metaDataA->addCc(new \SendGrid\Mail\Cc('[email protected]', 'User 3'));
$email->addRecipient('[email protected]', 'User 1', $metaDataA);
// Send the email to user4, and BCC user5
$metaDataB = new \SendGrid\Mail\Personalization();
$metaDataB->addDynamicTemplateData('sendgrid_var_1', 'custom data value 3');
$metaDataB->addDynamicTemplateData('sendgrid_var_2', 'custom data value 4');
$metaDataB->addBcc(new \SendGrid\Mail\Bcc('[email protected]', 'User 5'));
$email->addRecipient('[email protected]', 'User 4', $metaDataB);
// Send out the email template with data attached to it
$email->send();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.