PHP Controls Bootstrap controls for PHP
\Bootstrap\Components\Alert
Code
$alert = new \Bootstrap\Components\Alert('Your transaction has been successfully processed! Thank you for your purchase :)', 'success');
$alert->class('m-0');
$alert->printHtml();
Result
Documentation
\Bootstrap\Components\Alert
A component that enables you to easily write <div.alert> control through PHP.
Usage
Instantiate the Alert by passing a content and type.
$alert = new \Bootstrap\Components\Alert('Your transaction completed successfully', 'success');
// continued below...
Options
Alert::options
| Option | Default | Description |
|---|---|---|
dismissible |
true |
If the alert is dismissible |
Example:
// during init
$alert = new \Bootstrap\Components\Alert('Your transaction completed successfully', 'success', ['dismissible' => false]);
// after init
$alert->options('dismissible', false);
Other properties
Alert::content- The content of the alertAlert::class- Sets theclassattribute
Styling
To learn more about styling the <div.alert>, see UI Alerts demo.
Finally, once you configured your alert, you can now htmlPrint it!
$alert->printHtml();
Credits
\Bootstrap\Components\Alert is part of the lodev09/bootstrap-php package created by @lodev09.