Download the PHP package gloudemans/notify without Composer

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

Laravel Notify

Build Status Total Downloads License

Some helpful tools for getting handy flash notifications on your website Out of the box support for: Toastr, SweetAlert, Bootbox and native notifications!

Installation

Install the package through Composer. Require this package with Composer using the following command:

composer require gloudemans/notify

Next you need to register the package in Laravel by adding the service provider. To do this open your config/app.php file and add a new line to the providers array:

Gloudemans\Notify\LaravelNotifyServiceProvider::class,

Now that the package has been registered you can copy the package config file to your local config with the following command:

artisan vendor:publish --provider="Gloudemans\Notify\LaravelNotifyServiceProvider" --tag="config"

Now your all set to use the notification package in your Laravel application.

Optional

If you'd like to use the Notification facade, add a new line to the aliases array:

'Notification' => Gloudemans\Notify\Notifications\NotificationFacade::class,

Usage

Using this package is actually pretty easy. Adding notifications to your application actually only requires two steps.

Adding a notification

First, of course, you need a way to flash the notification to session so they are available on the next request. If you've injected the Gloudemans\Notify\Notifications\Notification class into, for instance, your controller, flashing the notification to the session is as easy as this:

$this->notification->add('success', 'Notification message', 'Notification title');

And if you're using the facade it's as easy as:

Notification::add('success', 'Notification message', 'Notification title');

To make life even easier there are also four helper methods for different types of notification. So instead of manually supplying the notification type you can simply call a method with the type as its name:

Finally you can also add the Gloudemans\Notify\Notifications\AddsNotifications trait to your class, which will supply you methods for adding the notifications:

Displaying the notifications

The second step is to actually show the notifications on your website. All notifications can be rendered using the render() method on Gloudemans\Notify\Notifications\Notification.

So a possibility is to add something like this to one of your views:

But if you're like me and don't like code like this in your view there's a nice little Blade directive available:

@notifications

Adding this Blade directive to one of your views give the package a place to render the JavaScript output for rendering the notifications.

The recommended location for rendering the notifications is at the bottom of your 'master' layout file

Renderers

The packages uses dedicated 'renderer' classes for rendering the notifications. Out of the box you can choose between: native (default), toastr, sweetalert and bootbox. To change the renderer that the package uses, simply update the value of notifications in the notifications.php config file.

The native renderer is the only renderer that doesn't require any extra JavaScript libraries as it uses simple alert() functions for showing the notification.

For all the other renderers the necessary scripts and stylesheets are bundled with the package and can be copied to your public directory with the following command:

artisan vendor:publish --provider="Gloudemans\Notify\LaravelNotifyServiceProvider" --tag="assets"

But of course you're free to download them manually or pull them in with another service and include them in your asset build sequence.

Make sure the scripts are added BEFORE you call the render() method

Extending

If you want to use another library for notifications in your project, that's totally possible! What you need to do is create your own renderer and change a binding in the service container of Laravel.

Your custom renderer must implement the Gloudemans\Notify\Notifications\NotificationRenderer interface, which forces you to implement one simple method:

Once you've created your custom renderer you can bind it to the interface like this:

And that's all you need to do to extend the package with your custom renderer.


All versions of notify with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
illuminate/support Version ^5.1
illuminate/session Version ^5.1
illuminate/view Version ^5.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 gloudemans/notify contains the following files

Loading the files please wait ....