PHP code example of uhin / laravel_api

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';
}

(new RabbitSender)->send(json_encode([
       'job_id' => '12312312',
       'source' => 'sftp',
       'filename' => 'test-file.x12',
       'data' => 'alskfl'
   ]));
        
$rabbit = new RabbitSender(true, new MPILookupQueueBuilder());
$rabbit->send(json_encode($message));
        
$rabbit->setExchange(config('uhin.workers.lookup_mpi_exchange'));
$rabbit->setRoutingKey(config('uhin.workers.lookup_mpi_routing_key'));
 artisan uhin:workers:start
 artisan uhin:workers:stop
 artisan uhin:workers:drain

$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();