Download the PHP package newton-labs/alertify-bundle without Composer

On this page you can find all versions of the php package newton-labs/alertify-bundle. 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 alertify-bundle

Troopers

Gitter License Version SensioLabsInsight

Alertify Bundle

What is the point ?

This bundle allows you to easily harmonize alerts and others notifications. Declare in the config (or just use the default configuration) and dispatch alerts with the following libraries (or your own):

Installation

First, require it thanks to composer:

composer.phar require troopers/alertify-bundle:dev-master

Add it in your AppKernel.php:

public function registerBundles() {
    $bundles = array(
        [...]
        new Troopers\AlertifyBundle\TroopersAlertifyBundle(),
        [...]

To include the library of your choice, you have these 2 methods :

automatically with https://github.com/Troopers/AsseticInjectorBundle (recommended)

Just add the name of the resource tag (e.g alertify-toastr) in your regular assetic's block.

For example, this code ...

and the same way for stylesheets (if needded) and for each one of availables librairies (alertify-notie, alertify-codrops-notification...).

manually

If you want to do this manually, you'll have to read the Resources/config/assetic_injector.json file and add them manually :

and the same way for stylesheets.

Configuration ?

To define the default configuration of your alerts, you can add the following lines in your config.yml :

By default, even if you do not declare any context, Alertify setup default values. You can override these settings easily like this:

How to ?

It's easy to use, just follow the following:

Add this block at the end of your twig layout:

 {% block alertify %}
    {{ app.session|alertify|raw }}
 {% endblock %}

Now, anywhere, you can put your alert in the flash session and enjoy.

$this->get('session')->getFlashBag()->add('success', 'ok');
$this->get('session')->getFlashBag()->add('warning', array('body' => 'ok');
$this->get('session')->getFlashBag()->add('warning', array('body' => 'ok', 'context' => 'front');

You can use the troopers_alertifybundle.helper.alertifyhelper service to ease the alert creation :

$this->container->get('troopers_alertifybundle.helper.alertifyhelper')->congrat('TEST');
$this->container->get('troopers_alertifybundle.helper.alertifyhelper')->warn('TEST');
$this->container->get('troopers_alertifybundle.helper.alertifyhelper')->inform('TEST');
$this->container->get('troopers_alertifybundle.helper.alertifyhelper')->scold('TEST');

You can also use the AlertifyControllerTrait to have simple methods in controller :

If you have two contexts in your application (front and back for example), I spur you to override these functions in your controller in each side to pass automatic context like this :

Display alerts with a custom library

TroopersAlertify comes with some librairies to ease use but it's free to you to use custom Library (feel free to make a Pull request, your library could interest community :). You just have to follow these steps :

Then just override app/Resources/TroopersAlertifyBundle/views/Modal/myOwnSystem.html.twig and add the alert initialization.

Options

Modal

To call a modal box, just use a flash named 'modal':

$this->get('session')->getFlashBag()->set("success", array('engine' => 'modal', 'title' => "Wow", 'button_class' => "btn btn-primary btn-large", "body"=> "<div>Some info</div>"));

as you see, you can pass some arguments tu customize the modal, availables ones are:

title:
  (html) string
button-class:
  you con specify classes to customize your button
body:
  html string
hasHeader:
  boolean (default = true)
hasFooter:
  boolean (default = true)
deleteIcon:
  string : icon-class (for example: "fa fa-times")
id:
  string : (default: "alertify-modal")

Callback type

There is a final type of Alert you can call, the callback Callbach allow you to call any action in you project, thats awesome if you want put dynamic content in your alery. To work, the called action have to render a view. It's very usefull to include a form in a modal for exemple.

$this->get('session')
  ->getFlashBag()
  ->set('callback', array(
      'engine' => 'modal',
      'title' => 'Wow',
      'action' => 'AcmeBundle:Default:hello',
      'button_class' => 'btn btn-primary btn-large',
      'body' => '<p>Yeah that's crazy !</p>'
    )
);

This type is very simple to use, just call the callback alery, and in the options define "type" with the final alert you want, the action with the action you want call, and other options specific to the alery you choose.

Ajax mode

We told you to add the alertify filter in your layout. This is great but what if you want to use ajax in your application ?

Actually, this library is not really made for it but you can simply add this part of code to trigger alerts in your new ajax content :

{% if app.request.isXmlHttpRequest %}
    {{ app.session|alertify|raw }}
{% endif %}

Confirm modal

After a link's clic or form's submission, we sometimes want to prompt the user to be sure he understood what he did. You can make it as a simply way by following the doc here : (https://github.com/Troopers/TroopersAlertifyBundle/blob/master/README_Confirm.md)


All versions of alertify-bundle with dependencies

PHP Build Version
Package Version
Requires friendsofsymfony/jsrouting-bundle Version 2.0.*@dev
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 newton-labs/alertify-bundle contains the following files

Loading the files please wait ....