jaxon-php/jaxon-toastr

This package is abandoned and no longer maintained. The author suggests using the jaxon-php/jaxon-dialogs package instead.

Jaxon notification plugin with the Toastr library.

v1.0.2 2016-11-17 18:55 UTC

This package is auto-updated.

Last update: 2022-02-01 12:59:10 UTC


README

This package implements javascript notification in Jaxon applications using the JQuery Toastr library. https://github.com/CodeSeven/toastr.

Features

  • Enrich the Jaxon response with notification functions.
  • Automatically insert the Js and CSS files of the Toastr library into the HTML page.

Installation

Add the following line in the composer.json file.

"require": {
    "jaxon-php/jaxon-toastr": "1.0.*"
}

Or run the command

composer require jaxon-php/jaxon-toastr

Configuration

By default the plugin loads the Js and CSS files from CDN JS.

  • cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js
  • cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css

This can be disabled by setting the assets.include.toastr option to false.

The options of the Toastr library can be set under the toastr.options. section of the Jaxon configuration. See here for the full list of options.

Usage

This example shows how to print a notification.

function myFunction()
{
    $response = new \Jaxon\Response\Response();

    // Process the request
    // ...

    // Print a notification with Toastr
    $response->toastr->success("You did it!!!");

    return $response;
}

The toastr attribute of Jaxon response provides the same functions as the Toastr library.

public function info($message, $title = null);
public function success($message, $title = null);
public function warning($message, $title = null);
public function error($message, $title = null);
public function remove();
public function clear();

Contribute

  • Issue Tracker: github.com/jaxon-php/jaxon-toastr/issues
  • Source Code: github.com/jaxon-php/jaxon-toastr

License

The project is licensed under the BSD license.