Download the PHP package ingress-it-solutions/livewire-toaster without Composer

On this page you can find all versions of the php package ingress-it-solutions/livewire-toaster. 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 livewire-toaster

Toaster Banner

Beautiful toast notifications for Livewire

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Toaster provides a seamless experience to display toast notifications in your Livewire powered Laravel apps.

Unlike many other toast implementations that are available, Toaster makes it effortless to dispatch a toast notification from either a standard Controller or a Livewire Component. You don't have to think about "flashing" things to the session or "dispatching browser events" from your Livewire components. Just dispatch your toast and Toaster will route the message accordingly.

Showcase

Toaster Demo

Contents

Installation

You can install the package via composer:

You can publish the package's config file:

This is the contents of the toaster.php config file:

Preparing your template

Next, you'll need to use the <x-toaster-hub /> component in your master template:

Configuring scripts

After that, you'll need to register the Toaster plugin with your resources/js/app.js bundle to start listening to incoming toasts:

Tailwind styles

Note Skip this step if you're going to customize Toaster's default view.

Toaster provides a minimal view that utilizes Tailwind CSS defaults.

If the default toast appearances suffice your needs, you'll need to register it with Tailwind's purge list:

Otherwise, please refer to View customization.

Usage

Sending toasts from the back-end

Note Toaster supports the dispatch of multiple toasts at once, you are not limited to dispatching a single toast.

Toaster

The standard recommended way for dispatching toast messages is through the Toaster facade.

If you need fine-grained control, you can always use the PendingToast class directly to which Toaster proxies its calls:

Toastable

You can make any class Toastable to dispatch toasts from:

Redirects

Whenever you return a RedirectResponse from anywhere in your app, you can chain any of the Toaster methods to dispatch a toast message:

This is, of course, not limited to Controllers as you can also redirect in Livewire Components.

Dependency injection

If you'd like to keep things "pure", you can also inject the Collector contract and use the ToastBuilder to dispatch your toasts:

Sending toasts from the front-end

You can invoke the globally available Toaster instance to dispatch any toast message from anywhere:

Available methods: error, info, warning & success

Automatic translation of messages

Note The translate configuration value must be set to true.

Instead of doing this:

Toaster makes it possible to do this:

You can mix and match without any problems:

You can do whatever you want, whenever you want.

Accessibility

Note The accessibility configuration value must be set to true.

Toaster will add an additional second to a toast's on-screen duration for every 100th word. This way, your users will have enough time to read toasts that are a tad larger than usual.

So, if your base duration value is 3 seconds and your toast contains 223 words, the total on-screen duration of the toast will be 3 + 2 = 5 seconds

Unit testing

Note If you make use of automatic translation of messages, you should assert whether the translation keys are passed along correctly instead of the human readable messages that are replaced by Laravel's translator. Otherwise, your tests are going to fail as the messages are not translated during unit testing.

Toaster provides a couple of testing capabilities in order for you to build a robust application:

View customization

Warning You must keep the x-data and x-init directives and you must keep using the x-for loop. Otherwise, the Alpine component that powers Toaster will start malfunctioning.

Even though the default toasts are pretty, they might not fit your design and you may want to customize them.

You can do so by publishing Toaster's views:

The hub.blade.php view will be published to your application's resources/views/vendor/toaster directory. Feel free to modify anything to your liking.

Available viewData

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of livewire-toaster with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^10.0
livewire/livewire Version ^2.0
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 ingress-it-solutions/livewire-toaster contains the following files

Loading the files please wait ....