Search code examples
phplaravelcomposer-php

composer laravel create project


I'm trying to use laravel, when I start a project and type composer create-project /Applications/MAMP/htdocs/test_laravel in terminal it shows

[InvalidArgumentException]                                                   
Could not find package /applications/mamp/htdocs/test_laravel with stabilit  
y stable.    

and

create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [package] [directory] [version]

How to fix it ?
and is this step equal to create folder and file like I download from laravel git laravel-master.zip ?

--
MAMP php5.4.10


Solution

  • You are missing a parameter in the command. It should be in this order:

    composer create-project [PACKAGE] [DESTINATION PATH] [--FLAGS]
    

    You're mistakingly specifying your local path as the Composer/Packagist package you wish to create a project from. Hence the "Could not find package" message.

    Simply make sure you're specifying the Laravel package and you should be good to go:

    composer create-project laravel/laravel /Applications/MAMP/htdocs/test_laravel