mouf / html.widgets.messageservice
Use this package to display info/warning/error messages to the user on a web page. Using the SessionMessageService class, you register messages to be displayed. Using the MessageWidget class, you display the error messages in your templates.
Installs: 237 032
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 2
Open Issues: 0
Type:mouf-library
Requires
Requires (Dev)
- phpstan/phpstan: ^1.9
- squizlabs/php_codesniffer: ^3.3.1
- thecodingmachine/phpstan-strict-rules: ^1.0
README
This service allows to implement user oriented messaging. It relies on a simple function that will add a message with a given level, and an HTML block that will render user's messages when the page is loaded.
Using the Service
When the package is installed, a block is added to the template's content. When rendered, this block will dump the messages that were stored into the session.
Add a message :
$messageService->setMessage("User <b>foo bar</b> has been successfully cerated", UserMessageInterface::SUCCESS);
The UserMessageInterface
defines 4 types of message :
- SUCCESS
- INFO
- WARNING
- ERROR
By default, the message will be displayed in the header block. But you are free to insert this block anywhere.
More Information can be found here :