Download the PHP package dotkernel/dot-flashmessenger without Composer

On this page you can find all versions of the php package dotkernel/dot-flashmessenger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dot-flashmessenger

dot-flashmessenger

OSS Lifecycle PHP from Packagist (specify version)

GitHub issues GitHub forks GitHub stars GitHub license

Build Static codecov

SymfonyInsight

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. 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.

Installation

Run the following command in your project folder

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

Configuration

return [
    'dot_flashmessenger' => [
        'namespace' => 'flash messages session namespace name'
    ],
];

Sets the session namespace to use 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.

Getting the service in a factory

$container->get(FlashMessengerInterface::class);

Using the flash messenger service

To add and retrieve text messages

$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
$this->flashMessenger->getMessages('error');

Adding general data, not just messages, has a different method for that, accepting data as key/value pairs

$this->flashMessenger->addData('myData', $someData);

// next request
$this->flashMessenger->getData('myData');

There are also some predefined namespaces, along with shortcuts to add a message in the predefined namespaces

FlashMessengerInterface::ERROR_NAMESPACE
FlashMessengerInterface::WARNING_NAMESPACE 
FlashMessengerInterface::INFO_NAMESPACE 
FlashMessengerInterface::SUCCESS_NAMESPACE

using the methods:

/**
 * @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);

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, for easy parsing of messages blocks.

Registered services

Dot\FlashMessenger\FlashMessengerInterface::class

The flash messenger service

Dot\FlashMessenger\View\RendererInterface::class

The registered renderer class


All versions of dot-flashmessenger with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0
psr/http-message Version ^1.0 || ^2.0
laminas/laminas-servicemanager Version ^3.22.1
laminas/laminas-session Version ^2.17.0
mezzio/mezzio-template Version ^2.9.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dotkernel/dot-flashmessenger contains the following files

Loading the files please wait ....