Download the PHP package dieschittigs/contao-flash-bundle without Composer

On this page you can find all versions of the php package dieschittigs/contao-flash-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-flash-bundle

⚡ Contao Flash

This is a bundle for Contao 4.4+. It makes working with flash messages (short lived, informal messages for a single user) very convenient.

Features

Installation

Install via Contao Manager or Composer:

composer require dieschittigs/contao-flash-bundle

Basic Usage

Add a new frontend module "Flash Messages" to your page layout. This is where your messages will be displayed – at the top of the main container might be a good place.

If you want to display a message, say inside a hook method, do it like this:

// Info
Flash::info('The weather ☀️ is great today!');

// Success
Flash::success('Transaction complete.');

// Warning
Flash::warning('Wir brauchen mehr Silos!');

// Custom html message
Flash::comfirmnuke('<p>Please confirm.</p><a href="…">Yes.</a><a href="…">Nope.</a>');

ℹ️ The Flash class resides in the Contao namespace, so (probably) no use statement needed.

The messages will be saved in the users session. They wait until they are rendered in the frontend module, then they delete themselves. So you have longer running processes with multiple redirects and several messages? No problem 🕶️.

ℹ️ Messages "stack", so if you have e.g. multiple warnings, they will all be displayed once the frontend module gets displayed

The resulting HTML might look like this:

<div class="mod_flash_messages">
    <div class="flash-messages-wrapper">
        <ul class="flash-messages">
            <li class="flash-message warning">
                <i class="flash-icon"></i>
                <div class="flash-content">
                    The email address you entered was malformed …
                </div>
            </li>
            <li class="flash-message success">
                <i class="flash-icon"></i>
                <div class="flash-content">
                    … but we were able to fix it. Everything's fine.
                </div>
                <a href="flash/clear?id=id2" class="flash-dismiss"></a>
            </li>
        </ul>
        <div class="flash-comm">
            <script>
                window.ContaoFlash = window.ContaoFlash || {};
                window.ContaoFlash.clear = [id1, id2];
            </script>
            <noscript>
                <img width="1" height="1" src="flash/clear?ids=id1,id2" />
            </noscript>
        </div>
    </div>
<div>

Advanced Usage

Creating an advanced flash message

Flash::warning('Your account has been compromised.')
->setAutoDismiss(false) // User has to dismiss this message manually
->addClass(['important', 'user']) // Additional CSS classes
->setNamespace('profile') // Only show this message in modules with the matching namespace

Routes

Want to display your messages via JS? Got ya covered!

[GET] flash/get

Gets you an JSON array with all messages.

// Response
[
    {
        id: 'MIW987K',
        type: 'info',
        cssClasses: ['info'],
        message: 'Item purchased',
        autoDismiss: true,
        namespace: 'checkout'
    },
    …
]

[GET] flash/clear?id={id}

Purges the message with the provided id.

[GET] flash/clear?ids={id1,id2}

Purges the messages with the provided ids.

Customize

Take a peek at Resources/public for CSS and JS.

MIT © Die Schittigs


All versions of contao-flash-bundle with dependencies

PHP Build Version
Package Version
No informations.
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 dieschittigs/contao-flash-bundle contains the following files

Loading the files please wait ....