Download the PHP package coreplex/notifier without Composer

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

Notifier Build Status Latest Stable Version Coverage Status License

A PHP package to simply flash notifications and then render them with a JavaScript notifier. This package also comes with Laravel support out of the box.

Installation

This package requires PHP 5.4+, and includes a Laravel 5 Service Provider and Facade.

We recommend installing the package through composer. You can either call composer require coreplex/notifier in your command line, or add the following to your composer.json and then run either composer install or composer update to download the package.

Laravel 5 Integration

To use the package with Laravel 5 we firstly need to add the notifier and core service providers to the providers array in app/config/app.php.

If you wish to use the facade then add the following to your aliases array in app/config/app.php.

Finally once you've added the service provider run php artisan vendor:publish to publish the config file.

Usage

The notifier is made up of a couple of components; a template parser and the coreplex core session class.

To make the template parser you simply need to make a new instance of the Parser class. This class has no dependencies so it's a simple case of creating the object.

To see how to use the coreplex core session class check the docs.

Once you have the template parser and session you are ready to create the notifier. The notifier also requires the package config as a third parameter.

Usage With Laravel

Once you've set up the package to access the notifier you can either user the facade or you can inject the class by its interface.

Adding Notifications

To add a notification you can either call the notify method and pass a notification level, or you can call the notification level as a method. You specify the notification levels in the notifier config, you can see more about this in the setting up a notifier section below.

To pass data to the notification pass an array of key value pairs.

You can also add multiple notifications per request and they will all be rendered.

Rendering Notifications

To render notifications simply call the render method.

Setting up a Notifier

To add a notifier you simply need to a it into the notifiers array in the notifier.php config file. By default the package comes with config for the excellent alertify notifier.

A notifier is registered by adding an array made up of a template and the notification levels, and optionally any css files and js scripts.

Setting a Template

The template is used to render the notifications. When you call the render method it will loop through all of the notifications and render them to this template.

The template is always passed the notification level and then is also passed the array of dynamic data. To call access the data you wrap the key in double curly braces like so:

If a success notification was called using this template it would be rendered to the following string.

<script>notifier.success("Hello World!");</script>

It's very like that you wouldn't want to hard code the body of the notification so to access that dynamic data in the template you could use the following template.

Occasionally you may also only want to render data if it's been passed through. For example in the following template it will only render an icon if one has been passed through.

Setting Notification levels

Each notifier may have different names for their levels. To add some consistency the package by default requires an info, success and error level notifications. In the levels array you can specify the name your notifier uses for those levels.

For example with the alertify package it comes with log, success and error
notification levels. So the levels array would look like the following:

However you may wish for to have access to more levels than that so to register custom levels just add them to the array.

This level can then be called either using the notify method or by calling the name on the notifier instance.

Setting Scripts and Styles

If you are using multiple notifiers then you may not wish to load all of the styles or scripts on every request, but only when that notifer is being used. To do this you can set the paths to your styles in the css array and the paths to your js files in the scripts array.

Then to render the styles us the styles method and to render the scripts use the scripts method.


All versions of notifier with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
coreplex/core Version ~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 coreplex/notifier contains the following files

Loading the files please wait ....