title: Enable global middleware only for one environment in Laravel 5
body: <p>I'm using a global middleware in Laravel 5 (barryvdh/laravel-cors) but I only want it to be active on one environnement (dev). That's because I only require it with composer in dev environnement, so it's not installed in production.</p>
  
  <p>I registered it has a global middleware in App Kernel and so I have an error if I try to deploy my app in production (<code>Class 'Barryvdh\Cors\CorsServiceProvider' not found</code>). I know why, but I'm looking for a solution.</p>
  
  <p>Is there any way to declare a middleware globally in laravel 5 but only required in one environnement ?</p>
  
  <p>I hope it's clear enough, I can edit my post if not :)</p>