phpsymfonymercure

Can't install Mercure for Symfony project


I tried to follow the documentation for mercure and symfony found here but always encounter an error.

The first part :

>composer require mercure 

Works with no issue but as soon as I try to do the second one, I always get the same error.

The second action:

> mercure --jwt-key='!ChangeMe!' --addr='localhost:3000' --allow-anonymous --cors-allowed-origins='*'

The error :

time="2020-12-08T17:35:14+01:00" level=info msg="Mercure started" addr="'localhost:3000'" protocol=http
time="2020-12-08T17:35:14+01:00" level=fatal msg="listen tcp: lookup tcp/3000': getaddrinfow: The specified class was not found."

I have never used Mercure before so I have no idea what to do... please help


Solution

  • If you work on windows, you must create a bat file like this (mercureScript.bat) :

    set JWT_KEY=!ChangeMe!
    set ADDR=localhost:3000
    set ALLOW_ANONYMOUS=1
    set CORS_ALLOWED_ORIGINS=*
    .\mercure.exe
    

    And just run : .\mercureScript.bat

    Hoping it serves you !