This is a simple example of an application using Live Twig.
-
Get Mercure Hub running. You can have a look to the Mercure documentation. Simplest is with Docker:
docker run --rm -e CORS_ALLOWED_ORIGINS='http://localhost:8000' -e JWT_KEY='!ChangeMe!' -e DEMO=1 -e ALLOW_ANONYMOUS=1 -e PUBLISH_ALLOWED_ORIGINS='http://localhost,http://localhost:8000' -p 80:80 dunglas/mercure
-
Get your Mercure JWT token. If you are using the default demo
JWT_KEY
, you can get the token from your running hub's homepage.. -
Set environment variables
# .env # ... MERCURE_PUBLISH_URL=http://localhost/.well-known/mercure MERCURE_JWT_TOKEN=[your-token]
bin/console server:run