PHP code example of arc / events

1. Go to this page and download the library: Download arc/events 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/ */

    

arc / events example snippets


    \arc\events::cd('/foo/')->listen( 'onbeforesave', function( $event ) {
        return $event->preventDefault(); // don't allow saves in /foo/
    });

    $eventData = \arc\events::cd('/foo/bar/')->fire( 'onbeforesave' );
    if ( $eventData ) {
         // save something, but alas - it has been prevented by a listener
    }