falgunphp/notification

v0.0.3 2021-06-24 18:03 UTC

This package is auto-updated.

Last update: 2024-09-25 01:18:47 UTC


README

简单的通知管理库。

安装

请注意,需要 PHP 7.4 或更高版本。

通过 Composer

$ composer require falgunphp/notification

用法

<?php
use Falgun\Http\Session;
use Falgun\Notification\Notification;

$notification = new Notification(new Session());

$notification->successNote('Oh Yeah');
$notification->warningNote('Oh ho');
$notification->errorNote('hold up');
// all 3 notification has been saved to $_SESSION

$notes = $notification->flashNotifications(); // to get notifications and remove them from session
// or
$notes = $notification->getNotifications(); // only get notifications and don't remove them

foreach($notes as $note){
	echo $note->getMessage(); // this is the message of the note
	echo $note->getType(); // success or warning or error
}

许可证

MIT 许可证 (MIT)。请参阅 许可证文件 获取更多信息。