title: Unresolvable dependency resolving [Parameter #0 [ &lt;required&gt; $app ]] Lumen session
body: <p>I'm attempting to use Lumen session and cookie and it says <a href="https://lumen.laravel.com/docs/5.1/session" rel="nofollow noreferrer">here</a> that</p>
  
  <blockquote>
    <p>To enable sessions, you must uncomment all of the middleware within
    the $app->middleware() method call in your bootstrap/app.php file.</p>
  </blockquote>
  
  <p>which I did</p>
  
  <p><a href="https://i.stack.imgur.com/D4xWD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D4xWD.png" alt="enter image description here"></a></p>
  
  <p>now it gives me this errorr</p>
  
  <blockquote>
    <p>Lumen: Class Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse
    does not exist</p>
  </blockquote>
  
  <p>so as told <a href="https://stackoverflow.com/questions/36642933/lumen-class-illuminate-cookie-middleware-addqueuedcookiestoresponse-does-not-ex">here</a>, I did..</p>
  
  <blockquote>
    <p>composer require illuminate/cookie</p>
  </blockquote>
  
  <p>then add this to my <code>bootstrap/app.php</code></p>
  
  <pre><code>$app-&gt;singleton('cookie', function () use ($app) {
      return $app-&gt;loadComponent('session', 'Illuminate\Cookie\CookieServiceProvider', 'cookie');
  });
  
  $app-&gt;bind('Illuminate\Contracts\Cookie\QueueingFactory', 'cookie');
  </code></pre>
  
  <p>then run again, then gives me </p>
  
  <blockquote>
    <p>No application encryption key has been specified.</p>
  </blockquote>
  
  <p>so since Lumen unable to do <code>php artisan key:generate</code> which i think only available on Laravel so I grab an <code>APP_KEY</code> from one of my Laravel projects then put it unto my lumen <code>.env</code> file</p>
  
  <blockquote>
    <p>APP_KEY=base64:RjLhaOy8c54rE189sa9Ts+oXSkL2xCJ22MjgRLdqz6g=</p>
  </blockquote>
  
  <p>run and it gives me this error</p>
  
  <blockquote>
    <p>Unresolvable dependency resolving [Parameter #0 [ &lt;required&gt;
    $app ]] in class Illuminate\Support\Manager</p>
  </blockquote>
  
  <p>any help, ideas please? I just want to use Lumen session and cookie feature why so complicated?</p>