title: Lumen Global Middleware not working if registered outside bootstrap/app.php
body: <p>I wrote a custom Lumen package (specifically for users management). It works fine. However, when I tried adding a global middleware and registered it from within the package itself, it doesn't gets called (see below).</p>
  
  <p><strong>vendor/something/src/UserServiceProvider.php</strong></p>
  
  <pre><code>public function boot() {
      $this-&gt;app-&gt;middleware([
          SomeMiddleware::class
      ]);
  }
  </code></pre>
  
  <p><strong>vendor/something/src/Middlewares/SomeMiddleware.php</strong></p>
  
  <pre><code>class SomeMiddleware {
      public function handle(Request $request, \Closure $next) {
          exit('here'); // this was never called
      }
  }
  </code></pre>
  
  <p><strong>bootstrap/app.php</strong></p>
  
  <pre><code>$app-&gt;register(\Something\UserServiceProvider::class);
  </code></pre>
  
  <hr>
  
  <p>However, when I tried registering it in <em>bootstrap/app.php</em> instead inside the <em>UserServiceProvider.php</em> class, it works fine.</p>
  
  <p><strong>bootstrap/app.php</strong></p>
  
  <pre><code>// $app-&gt;register(\Something\UserServiceProvider::class);
  // ...
  $app-&gt;middleware([SomeMiddleware::class]);
  </code></pre>
  
  <p>Any advice?</p>