Package for flashing data now or later (in next request) for use in any micro/full-stack framework.

2.0 2021-05-06 07:22 UTC

This package is auto-updated.

Last update: 2024-10-06 14:48:11 UTC


README

Package for flashing data now or later (in next request) for use with any micro/full-stack framework.

Build status Code Coverage Latest Version Downloads PHP Version License

Install

composer require vaibhavpandeyvpz/phlash

Usage

<?php

$flash = new Phlash\ArrayFlash();

/**
 * @desc These will be available in current request.
 */
$flash->flashNow('messages', [
    'Thank your for registering with us.' => 'success',
]);

/**
 * @desc These will be available in next request.
 */
$flash->flashLater('errors', [
    'name' => ['This field is required.'],
]);

/**
 * @desc Get all (or by key) flashed data for the current + previous request.
 */
$messages = $flash->get() || $flash->get('messages');

License

See LICENSE file.