Download the PHP package heimrichhannot/contao-status-message-bundle without Composer

On this page you can find all versions of the php package heimrichhannot/contao-status-message-bundle. 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 contao-status-message-bundle

Contao Status Message Bundle

This bundle offers a status message queue for the frontend of the Contao CMS

Features

Impressions

The status message queue in the frontend

Installation

  1. Install via composer: composer require heimrichhannot/contao-status-message-bundle.
  2. Update your database as usual via migration command or install tool.

Concepts

Message scopes

In order to add a new status message, you need to know the following things:

  1. What's the text of the message you'd like to output?
  2. What's the type of the message (success, error, ...)?
  3. What's the scope of the message (general scope, a specific module or content element, ...)?

Particularly, the third parameter could be not obvious. In the context of this bundle, you can create not only one "status message queue" but as many as you like. In order to distinguish these in the frontend where you output them, you need to tell the StatusMessageManager the scope of the message, you'd like to add.

Currently, the scope can be:

  1. General -> no specific context
  2. Module -> a specific frontend module (id must be passed)
  3. Content element -> a specific frontend content element (id must be passed)

Internally this bundle uses symfony's session flash bag API. If you're not familiar with these, please take a look into the documentation.

Hence, the scope described above is described by the flash bag key. For the sake of ease, we call it scope key in the context of this bundle.

For example, if you like to bind your messages to a specific module, the scope key might be something like huh_status_message.module.1234 whereas module is the scope and 1234 is the module id.

Usage

Add status messages

Output messages via the frontend module "status message queue"

In order to output your status messages, you can create a "status message queue" frontend module and include it in your article or layout, for example.

IMPORTANT: Please take care of the order of inclusion for this module. If you add messages before the queue module is rendered, the messages are displayed after a site reload only (messages are stored in the session).

Programmatically output messages in twig templates

Simply pass the scope key (which is the flash bag key internally) to your twig template and use symfony's flash message API to output the messages (scopeKey might be something huh_status_message.module.1234 whereas module is the scope and 1234 is the module id):

Programmatically output messages in traditional html5 templates

At first, so the necessary logic in your module (or content element) controller:

Then in your template, use the data as follows:

Developer notes

Why not use the Contao\Message class?

Of course, we use core classes if they're suiting our needs. One disadvantage is that the scope of a message is always determined by the scope string and the message type (see static::getFlashBagKey($strType, $strScope)):

This way, we couldn't have message queues with messages of mixed types.


All versions of contao-status-message-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
contao/core-bundle Version ^4.9
heimrichhannot/contao-utils-bundle Version ^2.204
symfony/config Version ^4.4||^5.0
symfony/event-dispatcher Version ^4.4||^5.0
symfony/http-kernel Version ^4.4||^5.0
symfony/http-foundation Version ^4.4||^5.0
terminal42/service-annotation-bundle Version ^1.1
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 heimrichhannot/contao-status-message-bundle contains the following files

Loading the files please wait ....