Install Laravel using Composer

后端 未结 7 2047
孤独总比滥情好
孤独总比滥情好 2020-12-17 05:45

I\'m trying to install Laravel using Composer, but after running the following command

composer create-project laravel/laravel cmsLaravel 5.2


        
相关标签:
7条回答
  • 2020-12-17 05:54

    Follow the steps below;

    1. Download and install Composer.
    2. Go inside the folder C:\xampp\htdocs>(if you are using xampp) or C:\wamp\www>(if you are using wamp) and open cmd/PoweShell & run the following commands:

      • composer global require "laravel/installer"
      • composer create-project laravel/laravel (after running this command a folder having name Laravel will be created there)
      • Now go inside Laravel folder and run php artisan serve command.
    3. After executing the last cmd, it will show an URL: http://127.0.0.1:8000; access the URL in a browser, which should reflect the will see the default webpage of Laravel.

    0 讨论(0)
  • 2020-12-17 06:01

    Check your index.php and Change the path as per your project directory

    Register The Auto Loader

    require __DIR__.'/cmsLaravel /vendor/autoload.php'; 
    $app =require_once __DIR__.'/cmsLaravel /bootstrap/app.php';
    
    0 讨论(0)
  • 2020-12-17 06:04

    Change your command to this:

    composer create-project laravel/laravel cmsLaravel 5.2.*
    

    This mean any sub version of laravel 5.2.

    0 讨论(0)
  • 2020-12-17 06:06

    To install Laravel using composer, all you need to do is to run in your terminal is:

    composer create-project --prefer-dist laravel/laravel blog
    

    Where: blog is the name of the folder containing your new Laravel instance.

    To install Laravel directly within your chosen directory (not in a folder within it as demonstrated above), simply run the same command but this time without a folder name as in:

    composer create-project --prefer-dist laravel/laravel
    

    Remember to run the command within your desired directory for the project; in your case, for C:\xampp\htdocs\, then, run either the first or second command as above base on your needs.

    This assumes you already have Composer properly installed as recommended on their website.

    Before you try addressing your failed to open stream: error, do avoid having folder names with space(s) as in your command above (obviously not the source of the error).

    Make sure you have the correct Server Requirements for Laravel
    the failed to open stream: error usually occur when the OpenSSL PHP Extension not enabled.

    • PHP >= 5.6.4
    • OpenSSL PHP Extension
    • PDO PHP Extension
    • Mbstring PHP Extension
    • Tokenizer PHP Extension
    • XML PHP Extension

    After enabling the required extension(s), do remember to restart your server, then run the following command:

    composer update
    
    0 讨论(0)
  • 2020-12-17 06:08

    You can just run

    composer install

    and it will process the required files to load the laravel in web browser

    EDIT:

    After seeing your comment, you should go to your laravel directory in your cmd.

    cd C:\xampp\htdocs\laravelCMS

    and run the command

    composer install

    0 讨论(0)
  • 2020-12-17 06:11

    composer create-project laravel/laravel 6.0

    composer is a tool for dependency management in PHP

    create-project is command to create a new laravel project

    laravel/laravel is for the skeleton application you get when creating a new project. It provides a default structure that's recommended (you're not forced to use it). The repository contains default config files, controllers, routes, etc. As well as code responsible for bootstrapping the application.

    Link Laravel/laravel

    6.0 Version in laravel

    0 讨论(0)
提交回复
热议问题