AppKernel, dependency injection, Twig rendering), making it a natural fit for Symfony-based applications. For non-Symfony PHP projects, integration would require significant abstraction work (e.g., manual service wiring, DI container emulation).sendinblue.api.client, enabling loose coupling with business logic. Ideal for modular architectures where email services are injected as dependencies.config.yml/parameters.yml. Dynamic API key injection (e.g., via environment variables) would require customization.composer.json:
composer require allprogrammic/sendinblue-bundle
AppKernel.php (Symfony <4.4) or config/bundles.php (Symfony ≥4.4).parameters.yml or environment variables (e.g., .env):
parameters:
sendinblue_api_key: '%env(SENDINBLUE_API_KEY)%'
config/packages/sendinblue.yaml (Symfony 4/5):
sendinblue:
api:
key: '%sendinblue_api_key%'
sendinblue.api.client into services/controllers:
use AllProgrammic\Bundle\SendinBlueBundle\Api\TransactionalMessage;
public function sendWelcomeEmail(SendinBlueClient $client) {
$message = new TransactionalMessage('Welcome!');
$message->from('no-reply@example.com', 'App Name')
->addTo('user@example.com')
->html($this->twig->render('emails/welcome.html.twig'));
$client->sendTransactional($message);
}
sendinblue.api.client in tests (e.g., using PHPUnit + Guzzle mocks).config/packages/).composer.json recommended:
"require": {
"guzzlehttp/guzzle": "^6.2 || ^7.0"
}
sendinblue.yaml.sendinblue:
api:
key: '%sendinblue_api_key%'
debug: '%kernel.debug%' # Logs API requests/responses
pagerfanta for pagination).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| SendinBlue API downtime | Emails undelivered | Fallback to SMTP or local queue. |
| Invalid API key | All API calls fail | Validate key on startup; alerting. |
| Rate limit exceeded | Emails queued/dropped | Implement retry logic with jitter. |
| Twig template errors | Email rendering fails | Validate templates pre-send; fallback plaintext. |
| Bundle compatibility issues |
How can I help you explore Laravel packages today?