Reputation: 139
So, i try to install the lumen restful api. Based on tutorial, i have to "serve" on php artisan. The command be like:
php artisan serve sample_api sample_api/public
then it shows:
Some say that serve command has been deleted in laravel 5 (which i use it). if so, what command should i use? or maybe find another tutorial?
Ps: Im a newbie :)
Thanks a lot!
Upvotes: 13
Views: 28258
Reputation: 863
Although there is no artisan make:command
in Lumen, you can follow this procedure to reimplement artisan serve
, or even use it as a template to create other console commands.
The serve command was removed since Laravel Lumen 5.2, but you can reimplement it manually as it follows:
Get the ServeCommand.php file from Lumnen 5.0, save it to the folder app/Console/Commands
and perform these 2 tweaks:
Laravel\Lumen\Console\Commands
to App\Console\Commands
.fire
to __invoke
.Edit the file app/Console/Kernel.php
to tell artisan the existence of this new command by listing it in the $commands
member, like so:
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\ServeCommand::class,
];
After doing that, you should be able to run artisan serve
. Notice that it will be serving a file server.php
from your project root folder. You need to create this file, or change the code to serve something else.
Upvotes: 0
Reputation: 163978
This command was removed from Lumen 5.2. You can use any other web server to run your app. I'd recommend to learn Homestead with built-in environment. If you're newbie, you can use something like WAMP.
Upvotes: 3