title: Lumen Micro Framework => php artisan key:generate
body: <p>I'm trying out the PHP micro Framework Lumen (from Laravel).</p>
  
  <p>One of my first steps was to look into the <code>.env.example</code> file and make a copy of it to have my <code>.env</code> file. There is a variable APP_KEY just like there is in Laravel. Now I tried out the simple command <code>php artisan key:generate</code> to get my new key But I ran into the following error message:</p>
  
  <blockquote>
    <p><strong>[InvalidArgumentException]</strong> There are no commands defined in the "key"
    namespace.</p>
  </blockquote>
  
  <p>Does some one know how I can generate keys for Lumen?</p>
  
  <p><strong>Update with solution</strong></p>
  
  <p>So I found my favorite solution for this problem. On the command line (Linux) I run <code>php -r "echo md5(uniqid()).\"\n\";"</code> what gives me something like this <code>7142720170cef01171fd4af26ef17c93</code>.</p>
  
  <p>If you are going to use Lumen more often, you may want to create an alias in your <code>.bashrc</code>, which is located in your home directory <code>/home/USERNAME</code>. To do so, you can open the file with <code>nano ~/.bashrc</code> or <code>vi ~/.bashrc</code> and copy the following alias at the end of the file, <code>alias phpkey='php -r "echo md5(uniqid()).\"\n\";"'</code>. Now you can use the command <code>phpkey</code> which will give you a 32 character long random string :)</p>