Skip to content

Extending ​

Everything is extended with tagged services, decorators and Twig hooks: no need to patch the plugin.

Payloads ​

ToImplementTag
Add contact attributesContactAttributeProviderInterfaceodiseo_brevo.contact_attribute_provider
Add product fieldsProductPayloadProviderInterfaceodiseo_brevo.product_payload_provider
Add order fieldsOrderPayloadProviderInterfaceodiseo_brevo.order_payload_provider
Add event propertiesEventPropertiesProviderInterfaceodiseo_brevo.event_payload_provider
Add or replace an eventTrackingEventInterfaceodiseo_brevo.tracking_event
Add rows to odiseo:brevo:debugDebugInfoProviderInterfaceodiseo_brevo.debug_info_provider
Add a step to odiseo:brevo:synca SyncStep serviceodiseo_brevo.sync_step

metaInfo (products and orders) and billing (orders) are merged by key, so several providers can add to them.

Decorators ​

ServiceInterfaceFor
odiseo_brevo.contact.attribute_mappingAttributeMappingInterfaceAttribute names per channel
odiseo_brevo.catalog.category_payload_builderWhat is sent for a category
odiseo_brevo.order.status_mapperOrderStatusMapperInterfaceOrder status rules
odiseo_brevo.tracking.consent_checkerTrackingConsentCheckerInterfaceTracking consent
odiseo_brevo.tracking.event_settingsTrackingEventSettingsInterfaceEvents on or off, and their names, per channel

Example: a contact attribute ​

php
namespace App\Brevo;

use Odiseo\SyliusBrevoPlugin\Client\Model\Attribute;
use Odiseo\SyliusBrevoPlugin\Contact\Attribute\ContactAttributeProviderInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;

#[AutoconfigureTag('odiseo_brevo.contact_attribute_provider')]
final class VipProvider implements ContactAttributeProviderInterface
{
    public function getAttributeTypes(): array
    {
        return ['vip' => Attribute::TYPE_BOOLEAN];
    }

    public function provide(CustomerInterface $customer, ChannelInterface $channel): array
    {
        return ['vip' => 'VIP' === $customer->getGroup()?->getCode()];
    }
}

The key (vip) is sent as VIP unless contacts.attributes maps it to another name, and odiseo:brevo:attributes:setup creates it with that type. Values are ready for Brevo (dates as Y-m-d, amounts as decimals); null or "" is not sent.

Sending your own events ​

Dispatch TrackOrderEvent or TrackCustomerEvent with the event code through BrevoMessageDispatcherInterface: it's sent after the response, once per request. For any other subject, write your own message and call TrackingEventSenderInterface from its handler.

Never call Brevo from a request: implement BrevoMessageInterface, send it with BrevoMessageDispatcherInterface and handle it on the odiseo_brevo.bus.

Admin ​

The channel configuration form is split in tabs. Add one with the side_navigation/tab.html.twig and sections/tab.html.twig templates (tab, label and optional module in the hookable configuration) on the odiseo_brevo.admin.channel_configuration.{create,update}.content.form.side_navigation and .sections hooks, and cards in .sections.<tab>.

Shop ​

The tracker and the newsletter section are Twig hooks (sylius_shop.base.head, sylius_shop.base.footer): disable or move them like any other hook. Templates can be overridden in templates/bundles/OdiseoSyliusBrevoPlugin/.

Pro Pro ​

ToImplementTag
Add email paramsEmailParamsProviderInterfaceodiseo_brevo_pro.email_params_provider
Add samples for an emailEmailSampleProviderInterfaceodiseo_brevo_pro.email_sample_provider
Handle more webhook eventsWebhookEventHandlerInterfaceodiseo_brevo_pro.webhook_event_handler
Register more webhook typesWebhookDefinitionInterfaceodiseo_brevo_pro.webhook_definition

Free plugin released under the MIT License. Brevo Pro under a commercial license.