digiaonline/notification-wrapper

This package is abandoned and no longer maintained. No replacement package was suggested.

A super-basic wrapper for notifications/messages

1.0.0 2018-12-12 12:33 UTC

This package is auto-updated.

Last update: 2023-03-12 21:34:40 UTC


README

Build Status

A super-basic wrapper for notifications/messages

Installation

composer require digiaonline/notification-wrapper

Usage

// Create a notification
$notification = new Notification('TYPE_FOO', ['id' => 1, 'name' => 'John']);

// Encode it as JSON (now you can send it somewhere)
$json = \json_encode($notification);

// Decode the notification on the other end
$notification = Notification::fromJson($json);

var_dump($notification->getType() === 'TYPE_FOO'); // true
var_dump($notification->getPayload() === ['id' => 1, 'name' => 'John']); // true

License

MIT