Harmonize notifications in your Symfony app.
If you want to force the trigger of an alert, after an ajax call for example, you need to send through the response a custom header : X-Inject-Alertify
. When its value is set to true
, then the alert append at the end of the response content, even if it is empty. Note that the 204
status code (No content) is incompatible with this header, as the 204 response MUST NOT include a message-body.
return new Response(null, 200, [
'X-Inject-Alertify' => true
]);
Please note that the troopers_alertifybundle.helper.alertifyhelper
has been renamed into alertify