1. Go to this page and download the library: Download sendlayer/sendlayer-php 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/ */
sendlayer / sendlayer-php example snippets
endLayer\SendLayer;
use SendLayer\Exceptions\SendLayerException;
// Initialize the SDK with your API key
$sendlayer = new SendLayer('your-api-key-here');
try {
// Send a simple email
$response = $sendlayer->Emails->send(
from: '[email protected]',
to: '[email protected]',
subject: 'Test Email',
text: 'This is a test email sent using the SendLayer PHP SDK'
);
echo "Email sent successfully! Message ID: " . $response['MessageID'];
} catch (SendLayerException $e) {
echo "Error: " . $e->getMessage();
}