jaxon-php / jaxon-toastr
Jaxon notification plugin with the Toastr library.
Requires
- jaxon-php/jaxon-core: ~1.0
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.