PHP code example of koalabs / evento

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

    

koalabs / evento example snippets


"    "koalabs/evento": "1.*"
},

'Koalabs\Evento\EventoServiceProvider'

'Evento' => 'Koalabs\Evento\Facades\Evento'

/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
public function store()
{
    $input = Input::only('title', 'subtitle', 'author');

    $podcast = Podcast::create($input);

    Evento::fire(new PodcastAdded($podcast));
}
  


use Koalabs\Evento\EventListener;
use Podcasts\Events\PodcastAdded;

class EmailNotifier extends EventListener {

  public function whenPodcastAdded(PodcastAdded $podcast)
  {
    // Do some stuff here
  }

}


use Illuminate\Support\ServiceProvider;

class ListenerServiceProvider extends ServiceProvider {

  /**
   * Register the service provider
   * 
   * @return void
   */
  public function register()
  {
    $listeners = $this->app['config']->get('evento::listeners');

    foreach ($listeners as $listener)
    {
      $this->app['events']->listen('Habitat.*', $listener);
    }
  }

}

php composer.phar update