1. Go to this page and download the library: Download xblabs/ripple 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/ */
xblabs / ripple example snippets
$dispatcher = new XB\Ripple\Dispatcher();
use XB\Ripple\Event;
use XB\Ripple\Dispatcher;
$dispatcher = new Dispatcher();
// Dispatch by name; returns an array of listener responses, or null if nothing handled it.
$responses = $dispatcher->dispatch( 'user.login' );
// Dispatch with a target object and params. $user is the target; ['id' => 123] the params.
$dispatcher->dispatch( 'user.login', $user, [ 'id' => 123 ] );
// Or build the Event yourself.
$dispatcher->dispatch( new Event( 'user.login', $user, [ 'id' => 123 ] ) );
// Dispatch and stop at the first listener that returns a truthy value.
$result = $dispatcher->dispatchUntil( 'user.login' );
// Dispatch and return only the first response.
$result = $dispatcher->dispatchGetFirst( 'user.login' );
$dispatcher->setEventClass( MyEvent::class ); // must extend XB\Ripple\Event
use XB\Ripple\DispatcherStatic;
DispatcherStatic::addListener( 'user.login', $listener );
DispatcherStatic::dispatch( 'user.login' );
DispatcherStatic::setDispatcher( $myDispatcher ); // inject a specific instance
DispatcherStatic::reset(); // drop the shared instance entirely
use XB\Ripple\Dispatcher;
use XB\Ripple\Psr14\Psr14Dispatcher;
$ripple = new Dispatcher();
$ripple->addListener( 'user.login', $listener );
$psr = new Psr14Dispatcher( $ripple );
$event = $psr->dispatch( new XB\Ripple\Event( 'user.login' ) ); // returns the event
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.