Toastr in Laminas

Do you use toastr in your projects? Could someone please share their experience?

Do you mean GitHub - CodeSeven/toastr: Simple javascript toast notifications ?

Exactly. I would like to apply this alongside flashMessenger - return some messages using only flash, and some using flash and toastr. For Laravel, there are many examples of how to do it nice and easy - but for Laminas, I couldn’t find anything…

You mean calling toastr()->info('Hello World') in controller is nice? And what if the frontend changes tomorrow? Do you want to rewrite everything because a different library is used, like Bootstrap with Toasts or the next hype on the framework market? :wink:

I think you can use custom namespace for setting the message for different output on the plugin. Then the output of these messages must be customised. This can be done by overwriting the related view helper.

@froschdesign Thanks for the tips and for your patience. I wanted to provoke some other people into discussion with the mention of Laravel :joy:

I generally used flashMessenger with the namespace variable:




And in my helper I display the appropriate message depending on the toast type.


I hope this is a good solution.

Don’t worry, the problem can also be found in other systems. :wink:


$this->flashMessenger()->addMessage('article_create_error', 'toast_error');


1 Like