IziToast - viames/pair GitHub Wiki
Pair framework: IziToast
Pair\Html\IziToast builds JavaScript code for iziToast notifications.
Constructor
new IziToast(string $title, string $message, ?string $type = 'info')
Valid types: info, success, warning, error, question, progress.
Fluent methods
balloon(bool $flag)class(string $class)close(bool $flag)closeOnEscape(bool $flag)displayMode(int $mode)icon(string $icon)id(string $id)image(string $image)position(string $position)progressBar(bool $flag)theme(string $theme)timeout(int|bool $timeout)overlay(bool $flag)render(): string
Implementation example
$toast = (new \Pair\Html\IziToast('Saved', 'User updated', 'success'))
->position('topRight')
->timeout(3000)
->progressBar(true);
echo $toast->render();
In controllers, use app helpers:
$this->toast('Saved', 'User updated', 'success');
Pair can switch the toast driver globally through:
$app->setToastDriver('izitoast');
When no position is provided, IziToast uses the native iziToast default position.
Supported aliases are izitoast, sweetalert, sweetalert2 and swal.
See also: AppTrait, SweetAlert, SweetToast, Application.