title: Laravel 5.1 Register events at runtime
body: <p>I am new to Laravel 5.1 Events registration procedure and facing a problem when trying to register custom events at runtime which are not defined in the <code>EventServiceProvider</code> class.</p>
  
  <p>I have the following slightly modified Laravel 5.1 folder structure which includes a root <code>client</code> folder where I store all the client specific classes, events and view files. Folder structure is as following:</p>
  
  <pre><code>--app
     -- Events
       -- RecordUpdatedEvent.php
       -- more core events here...
     -- Listeners
       -- RecordUpdatedHandler.php
       -- more core listeners here...
  --bootstrap
  --client
    --Events
        --RecordUpdatedEvent.php
        --more client specific events...
    --Listeners
        --RecordUpdatedHandler.php
        --more client specific listeners...
    --resources
  --config
  --database
  --resources
  ...etc
  </code></pre>
  
  <p>I have the following composer psr-4 setup for namespacing and autoloading:</p>
  
  <pre><code>"psr-4": {
        "App\\": "app/",
        "Client\\": "client/"
      },
  </code></pre>
  
  <p>And of course performed <code>composer dump-autoload -o</code>. So far so good and it all works.</p>
  
  <p>I am trying to find a way to register client specific event handlers without manually changing the <code>EventServiceProvider</code> class every time I want to add a new client specific event (since <code>EventServiceProvider</code> is a core class that is shared between all clients).</p>
  
  <p>So for example, when an <code>App\Events\RecordUpdatedEvent</code> occur I will want to also fire a <code>Client\Events\RecordUpdatedEvent</code> (or more events) by dynamically resolving the events to be fired from the database.</p>
  
  <p>The problem is that when I programmatically fire a client specific event (i.e <code>Event::fire(Client\Events\RecordUpdatedEvent)</code>) it gets fired correctly but never dispatches the <code>Client\Listeners\RecordUpdatedHandler</code> class since it is never registered anywhere.</p>
  
  <p>My question will be how to register new event handlers during runtime or whether there is a way to specify within the event class itself (i.e <code>RecordUpdatedEvent</code>) which Handler class to dispatch. Ideally I would be able to set a class property such as <code>$this-&gt;handler = "Client\Listeners\RecordUpdatedHandler"</code>.</p>
  
  <p>Thanks.</p>