symfonylab / customerio-bundle
Integrates customer.io into Symfony
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.3
- ext-json: *
- symfony-bundles/json-request-bundle: ^2.0
- symfony/framework-bundle: 4.3.*
- symfony/monolog-bundle: ^3.4
- symfony/yaml: 4.3.*
- userscape/customerio: ^2.1
Requires (Dev)
- doctrine/doctrine-fixtures-bundle: ^3.2
- symfony/browser-kit: ^4.3
- symfony/maker-bundle: ^1.13
- symfony/phpunit-bridge: ^4.3
- symfony/profiler-pack: ^1.0
- symfony/routing: ^4.3
This package is not auto-updated.
Last update: 2025-03-16 08:42:52 UTC
README
Symfony integration for http://customer.io.
Configuration
Install the bundle using composer and register it in your Kernel.
Then configure your site_id
and api_key
:
# app/config/config.yml symfonylab_customer_io: site_id: <YOUR-SITE-ID> api_key: <YOUR-API-KEY>
Usage
Customer model
Implement SymfonyLab\CustomerIOBundle\Model\CustomerInterface
on your customer domain class.
Event Tracking / Customer identification
use SymfonyLab\CustomerIOBundle\Event\TrackingEvent; use SymfonyLab\CustomerIOBundle\Event\ActionEvent; /** @var \Symfony\Component\EventDispatcher\EventDispatcher $tracker */ $dispatcher = $this->getContainer()->get('event_dispatcher'); $customer = $repo->getCustomer(); // retrieve your customer domain object // send the customer over to customer.io for identification $dispatcher->dispatch(new TrackingEvent($customer)); // now track a `click` event $dispatcher->dispatch(new ActionEvent($customer, 'click'));
Webhooks
The bundle comes with a controller which can consume customer.io webhooks.
To use them, register the routing.xml:
# app/config/routing.yml customerio_hooks: resource: "@SymfonyLabCustomerIOBundle/Resources/config/routing.yaml"
Now your hook url will be http://your.project.com/webhook
which you
need to configure over at customer.io.
After doing so, you can listen to webhook events:
<service id="acme.webhooklistener" class="Acme\DemoBundle\Listener\WebhookListener"> <tag name="kernel.event_listener" event="customer_io.email_clicked" method="onClick" /> </service>
use SymfonyLab\CustomerIOBundle\Event\WebHookEvent; class WebhookListener { public function onClick(WebHookEvent $event) { $this->logger->info('Customer clicked on email with address: ' . $event->getEmail()); } }