prezent / pulse-bundle
Basic analytics event tracking in Symfony
Installs: 428
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
pkg:composer/prezent/pulse-bundle
Requires
- php: ^5.6|^7.0
- doctrine/doctrine-bundle: ^1.6.0
- symfony/framework-bundle: ^2.6|^3.0
This package is auto-updated.
Last update: 2025-09-29 01:41:16 UTC
README
Basic analytics event tracking in Symfony
The full documentation can be found in Resources/doc
Quickstart example
namespace AppBundle\Controller; use Prezent\PulseBundle\Event\PulseEvent; use Prezent\PulseBundle\Query\Query; use Symfony\Bundle\FrameworkBundle\Controller\Controller class AppController extends Controller { public function trackableAction() { $this->get('event_dispatcher')->dispatch(PulseEvent::EVENT, new PulseEvent('some.action', [ 'user' => $this->getUser()->getId(), ])); } public function analyticsAction() { $query = new Query(); $query ->setTypes(['some.action', 'other.action']) ->setStartDate(new \DateTime('-7 days')) ->setEndDate(new \DateTime()) ; return $this->render('AppBundle:App:analytics.html.twig', [ 'result' => $this->get('prezent_pulse.repository')->query($query), ]); } }
{% extends '::base.html.twig' %}
{% block body %}
<table>
<thead>
<tr>
<th></th>
{% for column in result.columns %}
<th>{{ column }}</th>
{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
{% for row in result %}
<tr>
<td>{{ row.key }}: {{ row.id }}</td>
{% for value in row %}
<td>{{ value }}</td>
{% endfor %}
<td>{{ row.total }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Total</th>
{% for value in result.columnTotals %}
<td>{{ value }}</td>
{% endfor %}
<td>{{ result.total }}</td>
</tr>
</tfoot>
</table>
{% endblock %}