Why has the artisan serve command been removed from Lumen 5.2?
You can find a very lightweight Composer package to add artisan serve
to your Lumen app https://github.com/mlntn/lumen-artisan-serve
Why don't you use PHP's built-in web server which comes out of the box when you install PHP onto your computer?
Just get into the root directory of your Lumen app and type the following, so your project will be served locally.
php -S localhost:8000 -t ./public
Note: This PHP built-in web server is intended only for Development environment.
I don't speak for Taylor, but my guess is that his reasoning is that a given microframework should not know - or care - about the server that's running it. A microframework should just assume that it's going to work, and leave it to the developer to figure out which tools are best to make that happen.
Laravel is different, in that it offers a more "complete" - and highly opinionated - set of tools to get your web application off the ground. In a full-stack framework, it's not uncommon to provide at least a simple PHP server script.
So with that in mind, it shouldn't be too hard to bootstrap Laravel's own server implementation and artisan commands into your Lumen app.
If you really want to use the php artisan serve
command rather than something a little more configurable like Vagrant, you can probably just copy Laravel's server.php into the root of your Lumen application, and then register Laravel's own Serve Command into Lumen.
You'll probably have to change line 42 for your base path, but aside from that, it should be pretty easy to port over.
Alternatively, you can try changing into the public
folder of your Lumen application and running php -S localhost:8080
. This definitely works on OS X - not sure about other platforms. You can also listen on port 80 but you will need to invoke the command with admin rights.
Although PHP's built-in web server was only added at version 5.4, Lumen requires PHP version 5.5.9 or higher, so this solution should work.