Download the PHP package zunnu/cake-toastr without Composer

On this page you can find all versions of the php package zunnu/cake-toastr. 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 cake-toastr

cake-toastr

This package was created primarily for personal use. It allows you to easily integrate Toastr messages into your CakePHP application

Installing Using Composer

cd to the root of your app folder (where the composer.json file is) and run the following command:

Then load the plugin by using CakePHP's console:

Note the flash component does not need to be loaded but you need to have flash render in your layout.

Usage

Loading the Component

Load the component you will need to modify your src/Controller/AppController.php and load the toastr component in the initialize() function

Loading the Helper

Sure, you could load the view helper anywhere you like—like in a random controller or buried deep inside a view. But if you actually want things to work smoothly, and, you know, avoid a headache, just load it in the layout where it belongs. Because who doesn't love clean, maintainable code, right?

See? Super simple. And if you're feeling extra fancy and want to tweak the options, go ahead and generate them from this magical place.

Using Flash Messages

From a controller, you can call it like a normal flash message:

This simple setup allows you to start using Toastr notifications with default settings. If you'd like to customize the behavior, you can pass additional options.

Customizing Toastr Notifications

Using Callbacks

You can customize the behavior of Toastr notifications using JavaScript callbacks such as onShown, onShow, onHide, and onHidden. For example, if you want to execute custom JavaScript when a toast is fully displayed, you can use the onShown callback.

Here's how to use the onShown callback:

This setup logs a message to the console when the toast is shown.

Injecting Custom CSS

You can also inject custom CSS to style your Toastr notifications. For instance, if you want to adjust the minimum width and position of your toast messages, you can pass custom CSS as follows:

This will ensure that the toast messages have a minimum width of 600px and are positioned 8% from the bottom of the screen.

Putting It All Together

Combine callbacks and custom CSS for a fully customized experience:

In this example, the toast background color is dynamically changed to a custom color when the toast is shown.

License

Licensed under The MIT License.


All versions of cake-toastr with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
cakephp/cakephp Version ^5.0.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 zunnu/cake-toastr contains the following files

Loading the files please wait ....