Search code examples
laravelcomposer-phplumenlaravel-artisan

Lumen Composer cannot detect vendor folder in newly created project


When creating new Lumen project using:

lumen new blogb

New directory is being created but vendor folders not occurs in newly created folder.

That way when I try

php artisan serve

I get following errors (because there is no vendor folder):

Warning: require_once(C:\Users\user\Desktop\blogb\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\user\Desktop\blogb\bootstrap\app.php on line 3

Fatal error: require_once(): Failed opening required 'C:\Users\user\Desktop\blogb\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\user\Desktop\blogb\bootstrap\app.php on line 3

EDIT: laravel new blog command works ok, and application can be run, but problem happens when lumen new blog is being executed.


Solution

  • After doing

    lumen new blog
    

    step in to blog directory and do following two things.

    1. cp .env.example .env to create .env file
    2. composer update to install and update dependencies. this will create the vender directory.

    Then once you visit your application in your webserver you'd get something similar to this.

    Lumen (5.5.0) (Laravel Components 5.5.*)
    

    Note:

    Since Lumen is a micro-framework you don't get some steps like composer update out-of-the-box like in Laravel. You'd have to do them manually.

    And you don't have the php artisan serve command either. Read why. use

    php -S localhost:8000 -t public
    

    instead or use Homestead or Valet

    Just to Add, you can also use your api doing http://localhost:8000/{routename} if you dont want to do php -S localhost:8000 -t public