PHP code example of architectnate / triggr-php

1. Go to this page and download the library: Download architectnate/triggr-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

architectnate / triggr-php example snippets


Triggr::fire("EventName");

Triggr::fire("EventName", array($arg1, $arg2, $arg3));

Triggr::fireHandler("EventName:HandlerName", array($arg1));

// With event name only
Triggr::watch("MyEvent", function(){ echo "Event has fired!"; });

// With full event phrase (nameing the handler ourselves)
Triggr::watch("MyEvent:FireMessage", function(){ echo "Event has fired!"; });

Triggr::watch("HelloWorld", function(){ return "Hello World"; });
$output = Triggr::fire("HelloWorld"); // Returns array("Hello World")

Triggr::watch("HelloWorld", function(){ return "Hello World"; }, array("RunLimit"=>1, "Priority"=>101));