{"id":33959035,"url":"https://github.com/alpine418/flash","last_synced_at":"2025-12-12T21:01:41.385Z","repository":{"id":57024946,"uuid":"284200594","full_name":"Alpine418/Flash","owner":"Alpine418","description":"NOT MAINTAINED ANYMORE. Flash messages service for Slim 4 and similar PSR-15 compliant frameworks or apps.","archived":true,"fork":false,"pushed_at":"2023-06-12T09:22:39.000Z","size":81,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-15T15:54:58.567Z","etag":null,"topics":["flash-messages","php73","psr-11","psr-15","slim","slim-framework","slim4"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alpine418.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-01T06:18:49.000Z","updated_at":"2023-06-12T09:26:24.000Z","dependencies_parsed_at":"2024-10-29T16:36:27.525Z","dependency_job_id":null,"html_url":"https://github.com/Alpine418/Flash","commit_stats":null,"previous_names":["jnessier/flash","neoflow/flash","alpine418/flash"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Alpine418/Flash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alpine418%2FFlash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alpine418%2FFlash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alpine418%2FFlash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alpine418%2FFlash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alpine418","download_url":"https://codeload.github.com/Alpine418/Flash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alpine418%2FFlash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27691467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flash-messages","php73","psr-11","psr-15","slim","slim-framework","slim4"],"created_at":"2025-12-12T21:01:33.979Z","updated_at":"2025-12-12T21:01:41.377Z","avatar_url":"https://github.com/Alpine418.png","language":"PHP","funding_links":["https://www.paypal.me/JonathanNessier"],"categories":[],"sub_categories":[],"readme":"# This project is no longer maintained.\nPlease use other solutions for flash messages with PHP.\n\n------------------------------------------------------------\n\n# Flash\n[![Build Status](https://github.com/neoflow/flash/workflows/Tests/badge.svg)](https://github.com/neoflow/flash/actions?query=branch:4.x)\n[![Latest Stable Version](https://poser.pugx.org/neoflow/flash/v?service=github)](https://packagist.org/packages/neoflow/flash)\n[![Total Downloads](https://poser.pugx.org/neoflow/flash/downloads?service=github)](//packagist.org/packages/neoflow/flash)\n[![License](https://poser.pugx.org/neoflow/flash/license?service=github)](https://packagist.org/packages/neoflow/flash)\n\nFlash service for Slim 4 and similar [PSR-15](https://www.php-fig.org/psr/psr-15/) compliant frameworks and apps.\n\n## Table of Contents\n- [Requirement](#requirement)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Session](#session)\n- [Contributors](#contributors)\n- [History](#history)\n- [License](#license)\n\n## Requirement\n* PHP \u003e= 7.3\n\n## Installation\nYou have 2 options to install this library.\n\nVia Composer...\n```bash\ncomposer require neoflow/flash\n```\n...or manually download the latest release from [here](https://github.com/Neoflow/Session/releases/).\n\n## Configuration\nThe following instructions based on [Slim 4](http://www.slimframework.com), in combination with\n [PHP-DI](https://php-di.org), but should be adaptable for any PSR-11/PSR-15 compliant frameworks and libraries.\n\nAdd the service `Neoflow\\Flash\\Flash` and middleware `Neoflow\\Flash\\Middleware\\FlashMiddleware`\n to the container definitions...\n```php\nuse Neoflow\\Flash\\Flash;\nuse Neoflow\\Flash\\FlashInterface;\nuse Neoflow\\Flash\\Middleware\\FlashMiddleware;\nuse Psr\\Container\\ContainerInterface;\n\nreturn [\n    // ...\n    FlashInterface::class =\u003e function () {\n        $key = '_flash'; // Key as identifier of the values in the storage\n        return new Flash($key);\n    },\n    FlashMiddleware::class =\u003e function (ContainerInterface $container) {\n        $flash = $container-\u003eget(FlashInterface::class);\n        return new FlashMiddleware($flash);\n    },\n    // ...\n];\n```\n...and register the middleware, to use the session as storage for the values. \n```php\nuse Neoflow\\Flash\\Middleware\\FlashMiddleware;\n\n$app-\u003eadd(FlashMiddleware::class);\n```\n**Please note** The session has to start first, before the middleware can get successfully dispatched. \n\nAlternatively, you can also load values from another storage than the session with a closure middleware...\n```php\n$app-\u003eadd(function ($request, $handler) use ($container) {\n    $storage = [ \n        // Your custom storage of the values\n    ];\n    $container-\u003eget(FlashInterface::class)-\u003eload($storage);\n    return $handler-\u003ehandle($request);\n});\n```\n...or add it directly in the container definitions and skip the middleware.\n```php\nuse Neoflow\\Flash\\Flash;\nuse Neoflow\\Flash\\FlashInterface;\n\nreturn [\n    // ...\n    FlashInterface::class =\u003e function () {\n        $key = '_flash'; // Key as identifier of the values in the storage\n        $storage = [\n            // Your custom storage of the values\n        ];\n        return new Flash($key, $storage);\n    },\n    // ...\n];\n```\n\nWhen your DI container supports inflectors (e.g. [league/container](https://container.thephpleague.com/3.x/inflectors/)),\n you can optionally register `Neoflow/Flash/FlashAwareInterface` as inflector to your container definition.\n\nAdditionally, you can also use `Neoflow/Flash/FlashAwareTrait` as a shorthand implementation of\n `Neoflow/Flash/FlashAwareInterface`.\n\n## Usage\nThe service `Neoflow\\Flash\\Flash` provides the most needed methods to get access to the values for the\n current request and to add values for the next request.\n```php\n// Set a value by key for the next request.\n$key = 'key'; // Key as identifier of the value\n$flash = $flash-\u003eset($key, 'Your custom value');\n\n// Get value by key, set for current request.\n$default = null; // Default value, when value doesn't exists or is empty (default: null)\n$value = $flash-\u003eget($key, $default);\n\n// Check whether value by key for current request exists.\n$exists = $flash-\u003ehas($key);\n\n// Count number of values for current request.\n$numberOfValues = $flash-\u003ecount();\n\n// Clear values of current and next request.\n$flash = $flash-\u003eclear();\n\n// Keep current values for next request. Existing values will be overwritten.\n$flash = $flash-\u003ekeep(); \n\n// Load values from storage as reference.\n$storage = [\n    '_flash' =\u003e []\n];\n$flash = $flash-\u003eload($storage);\n```\n\nFor more advanced use cases, you can also get and set the values for current and next request.\n```php\n// Get values set for next request.\n$nextValues = $flash-\u003egetNext();\n\n// Set values for next request. Existing values will be overwritten.\n$flash = $flash-\u003esetNext([\n    'key1' =\u003e 'value1'\n]);\n\n// Get values set for current request.\n$currentValues = $flash-\u003egetCurrent();\n\n// Set values for current request. Existing values will be overwritten.\n$flash = $flash-\u003esetCurrent([\n    'key1' =\u003e 'value1'\n]);\n```\n\n## Nice to know\nVersion 2.0 has been simplified and the message handling implementation has been removed. If you need the message\n handling please keep using version 1.2.\n\nIn earlier times, the library was also part of [Neoflow\\Session](https://github.com/Neoflow/Session) and then moved \n into a standalone library, to comply with the design principle of separation of concerns.\n\nIf you want to use a session service, you can easily combine both libraries as composer packages. \nThe integration and usage of [Neoflow\\Session](https://github.com/Neoflow/Session) is very similar to the\n current library.\n  \n## Contributors\n* Jonathan Nessier, [Neoflow](https://www.neoflow.ch)\n\nIf you would like to see this library develop further, or if you want to support me or show me your appreciation, please\n donate any amount through PayPal. Thank you! :beers:\n \n[![Donate](https://img.shields.io/badge/Donate-paypal-blue)](https://www.paypal.me/JonathanNessier)\n\n## License\nLicensed under [MIT](LICENSE). \n\n*Made in Switzerland with :cheese: and :heart:*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpine418%2Fflash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falpine418%2Fflash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpine418%2Fflash/lists"}