Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ jobs:
- ubuntu-latest

php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ jobs:
- ubuntu-latest

php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
3 changes: 3 additions & 0 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"backwardCompatibilityCheck": true
}
48 changes: 15 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# dot-flashmessenger

Flash messenger library for session messages between redirects.
A flash message, or session message is a piece of text data that survives one requests(available only in the next request).
This library accepts session data as well, not just string messages, with the same behaviour.
A flash message, or session message is a piece of text data that survives one request (available only in the next request).
This library accepts session data as well, not just string messages, with the same behavior.
The flash messenger is a convenient way to add data to the session and get it back on the next request without bothering with setting and clearing the data manually.

## Documentation
Expand All @@ -12,7 +12,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-flashmessenger/.
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-flashmessenger)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-flashmessenger/3.6.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-flashmessenger/3.7.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-flashmessenger)](https://github.com/dotkernel/dot-flashmessenger/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-flashmessenger)](https://github.com/dotkernel/dot-flashmessenger/network)
Expand All @@ -32,7 +32,7 @@ composer require dotkernel/dot-flashmessenger
```

This will also install `laminas/laminas-session` as session handling is based on this library.
Next, merge the `ConfigProvider` to your application's configuration
Next, merge the `ConfigProvider` to your application's configuration.

## Configuration

Expand All @@ -44,12 +44,12 @@ return [
];
```

Sets the session namespace to use for all flash messages and data
Sets the session namespace to be used for all flash messages and data.

## Usage

If following the installation step, you'll already have a FlashMessenger service in the service manager.
Just inject this service in you classes, wherever you need flash messages.
Inject this service in your classes, wherever you need flash messages.

### Getting the service in a factory

Expand All @@ -63,7 +63,7 @@ To add and retrieve text messages

```php
$this->flashMessenger->addMessage('error', 'This is a error flash message');
//on the next request you can get all messages from a namespace, or all messages from all namespaces if namespace is omitted
//on the next request you can get all messages from a namespace, or all messages from all namespaces if the namespace is omitted
$this->flashMessenger->getMessages('error');
```

Expand All @@ -87,36 +87,20 @@ FlashMessengerInterface::SUCCESS_NAMESPACE
using the methods:

```php
/**
* @param string $error
* @return void
*/
public function addError($error);

/**
* @param string $info
* @return void
*/
public function addInfo($info);

/**
* @param string $warning
* @return void
*/
public function addWarning($warning);

/**
* @param string $success
* @return void
*/
public function addSuccess($success);
public function addError(string|array $error);

public function addInfo(string|array $info);

public function addWarning(string|array $warning);

public function addSuccess(string|array $success);
```

## FlashMessengerRenderer

A class that is able to parse the content of the flash messenger service in an HTML format.
It uses the TemplateInterface to parse a partial, sending to the partial template the messages, the service and the renderer itself.
There are also a twig extension provided in [dot-twigrenderer](https://github.com/dotkernel/dot-twigrenderer), for easy parsing of messages blocks.
There is also a Twig extension provided in [dot-twigrenderer](https://github.com/dotkernel/dot-twigrenderer), for easy parsing of messages blocks.

## Registered services

Expand All @@ -129,5 +113,3 @@ The flash messenger service
```php
Dot\FlashMessenger\View\RendererInterface::class
```

The registered renderer class
30 changes: 10 additions & 20 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,28 @@

## Supported Versions


| Version | Supported | PHP Version |
|---------|--------------------|------------------------------------------------------------------------------------------------------------------------|
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-flashmessenger/3.4.2) |
| <= 2.x | :x: | |

| Version | Supported | PHP Version |
|---------|--------------------|--------------------------------------------------------------------------------------------------------------------|
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-flashmessenger/3.7.0) |
| <= 2.x | :x: | |

## Reporting Potential Security Issues

If you have encountered a potential security vulnerability in this project,
please report it to us at <security@dotkernel.com>. We will work with you to
verify the vulnerability and patch it.
If you have encountered a potential security vulnerability in this project, please report it to us at <security@dotkernel.com>.
We will work with you to verify the vulnerability and patch it.

When reporting issues, please provide the following information:

- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact

We request that you contact us via the email address above and give the
project contributors a chance to resolve the vulnerability and issue a new
release prior to any public exposure; this helps protect the project's
users, and provides them with a chance to upgrade and/or update in order to
protect their applications.

We request that you contact us via the email address above and give the project contributors a chance to resolve the vulnerability and issue a new release prior to any public exposure;
this helps protect the project's users and provides them with a chance to upgrade and/or update to protect their applications.

## Policy

If we verify a reported security vulnerability, our policy is:

- We will patch the current release branch, as well as the immediate prior minor
release branch.

- After patching the release branches, we will immediately issue new security
fix releases for each patched release branch.
- We will patch the current release branch, as well as the immediate prior minor release branch.
- After patching the release branches, we will immediately issue new security fix releases for each patched release branch.
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
}
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"psr/http-message": "^1.0 || ^2.0",
"laminas/laminas-servicemanager": "^3.22.1",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"laminas/laminas-session": "^2.17.0",
"mezzio/mezzio-template": "^2.9.0"
"mezzio/mezzio-template": "^2.9.0 || ^3.0.0",
"psr/http-message": "^1.0 || ^2.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions docs/book/v3/configuration.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Configuration

After installation, merge the `ConfigProvider` to your application's configuration
After installation, merge the `ConfigProvider` to your application's configuration.

```php
Dot\FlashMessenger\ConfigProvider::class,
```

Set the session namespace to use for all flash messages and data
Set the session namespace to be used for all flash messages and data.

```php
return [
Expand Down
6 changes: 3 additions & 3 deletions docs/book/v3/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

`dot-flashmessenger` is a library for session messages, between redirects.

A flash message, or session message is a piece of text data that survives one requests(available only in the next request).
A flash message, or session message is a piece of text data that survives one request (available only in the next request).

This library accepts session data as well, not just string messages, with the same behaviour.
This library accepts session data as well, not just string messages, with the same behavior.

The flash messenger is a convenient way to add data to the session and get it back on the next request without bothering with setting and clearing the data manually.

## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-flashmessenger)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-flashmessenger/3.6.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-flashmessenger/3.7.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-flashmessenger)](https://github.com/dotkernel/dot-flashmessenger/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-flashmessenger)](https://github.com/dotkernel/dot-flashmessenger/network)
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v3/renderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A class that is able to parse the content of the flash messenger service in an HTML format.
It uses the TemplateInterface to parse a partial, sending to the partial template the messages, the service and the renderer itself.
There are also a twig extension provided in [dot-twigrenderer](https://github.com/dotkernel/dot-twigrenderer), for easy parsing of messages blocks.
There is also a Twig extension provided in [dot-twigrenderer](https://github.com/dotkernel/dot-twigrenderer), for easy parsing of messages blocks.

Partial template example:

Expand Down
4 changes: 2 additions & 2 deletions docs/book/v3/usage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Usage

If following the installation step, you'll already have a FlashMessenger service in the service manager.
Just inject this service in you classes, wherever you need flash messages.
Inject this service in your classes, wherever you need flash messages.

## Using the flash messenger service

Expand All @@ -10,7 +10,7 @@ To add and retrieve text messages
```php
$this->flashMessenger->addMessage('error', 'This is a error flash message');

//on the next request you can get all messages from a namespace, or all messages from all namespaces if namespace is omitted
//on the next request you can get all messages from a namespace, or all messages from all namespaces if the namespace is omitted
$this->flashMessenger->getMessages('error');
```

Expand Down