It might help if you write out what exactly you are doing, and copy the exact error you are getting. This is too high level for anyone to help you out.
Composer is installed on my machine and when i attempt to install laravel i get this: _
** Wilsons-iMac:~ mac$ php laravel install Could not open input file: laravel
**_ if i just type laravel i get: Wilsons-iMac:~ mac$ laravel -bash: laravel: command not found
Have you installed laravel before you tried executing that command?
composer global require "laravel/installer"
Once you run the composer global require “laravel-installer”
that denjaland suggests, the laravel
command should be available globally. From there, run laravel new projectname
I ran these commands and got these errors Wilsons-iMac:~ mac$ laravel hiddentreasure -bash: laravel: command not found Wilsons-iMac:~ mac$ laravel -bash: laravel: command not found Wilsons-iMac:~ mac$
okay, but can you confirm that you ran composer global require "laravel/installer"
?
If so, laravel is installed, you just need to make sure your OS knows where to search for the executable when you run laravel. Therefore, you need to make sure that your composer vendor/bin
path is in the $path
array used by your OS to scan for your executables. THis depends on your OS though.
It's all in the laravel installation instructions...
I executed these commands and got these results. Wilsons-iMac:~ mac$ composer create-project laravel/laravel your-project-name 4.2.* Installing laravel/laravel (v4.2.11)
php artisan clear-compiled Mcrypt PHP extension required. Script php artisan clear-compiled handling the post-update-cmd event returned with error code 1 Wilsons-iMac:~ mac$ php artisan serve Could not open input file: artisan someone tried to get me to just execute that exact command. So I did this is the furthest i have gotten towards installing laravel. I want to run it from mamp, however it isnt even in the mamp directory. Should i move it it. Every time i execute any new install command it moves it without me issuing any commands? Is this normal?
Then i did this: Last login: Sun Jun 25 17:19:36 on ttys000 Wilsons-iMac:~ mac$ laravel -bash: laravel: command not found Wilsons-iMac:~ mac$ your-project-name -bash: your-project-name: command not found Wilsons-iMac:~ mac$ sublime your-project-name -bash: sublime: command not found Wilsons-iMac:~ mac$ composer create-project laravel/laravel laravel-demo Installing laravel/laravel (v5.4.23)
php -r "file_exists('.env') || copy('.env.example', '.env');" Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 59 installs, 0 updates, 0 removals
Illuminate\Foundation\ComposerScripts::postUpdate php artisan optimize Generating optimized class loader The compiled services file has been removed. php artisan key:generate Application key [base64:7s6tmOeDvXJXHYjftLhzpzTMyYOqJ57r8RO5ObotkFo=] set successfully. Wilsons-iMac:~ mac$ cd laravel-demo Wilsons-iMac:laravel-demo mac$ subl . -bash: subl: command not found Wilsons-iMac:laravel-demo mac$ laravel-demo -bash: laravel-demo: command not found Wilsons-iMac:laravel-demo mac$ laravel -bash: laravel: command not found Wilsons-iMac:laravel-demo mac$ laravel -v -bash: laravel: command not found Wilsons-iMac:laravel-demo mac$ artisan -bash: artisan: command not found Wilsons-iMac:laravel-demo mac$ php laravel install Could not open input file: laravel Wilsons-iMac:laravel-demo mac$
What do you need laravel for at this point? You did install the project - as soon as that is done (you did it using composer in stead of the laravel command, which is perfectly fine), all you need is php command.
In the root of your project, there is a file artisan, which can be executed by php running php artisan
artisan gives you some nice commands that will help you speed up your development process. You're not required to use them though I suggest you do.
Good luck.
If you wanna install laravel you must install Laravel globally with composer global require “laravel-installer
so you can use Laravel command. If you done install laravel globally then you can install your laravel project with laravel new YourProjectName
. Hope this help you bro.
Faisal, we already told him, but I believe the compose vendor bin directory is not listed in his $path variable so the OS doesn't find the command. you can install it globally in composer, but if the composer vendor bin is not listed, it won't find it.
I did this Wilsons-iMac:~ mac$ composer create-project laravel/laravel test-laravel-5-project dev-develop --prefer-dist
[InvalidArgumentException]
Could not find package laravel/laravel with version dev-develop in a versio
n installable using your PHP version 5.6.30.
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>] These are the errors I basically ran the same command faisalamir suggested.
Thanks for the reply. I will try running it locally to my project. I am running it in mamp so i just place the artisan file in the directory of my project? Please explain so that i clearly understand. I need it for working with real time communication sockets that work with dashboards.
I'm a bit lost as to what you need help with now. Each post you write seems to be asking for input on something entirely different. Could you perhaps try and focus on one problem at the time?
I am with denjaland. I am a little lost as well. A few quick thoughts after scanning through the previous posts. It would appear you need a few things:
-> Your composer bin in your path to run laravel commands. On a mac the command (to be put into the terminal) is:
export PATH="$PATH:$HOME/.composer/vendor/bin"
This should be done after you composer global require the laravel installer. Once that is done type laravel into the terminal and hit enter. Options should come up. If they do then go ahead and create a new project. You can do this by typing this into the terminal:
laravel new /path/to/where/you/want/your/project/projectname
so example
laravel new ~/Sites/foobar
However, you already installed laravel so no need to run these commands. I just wanted to give an example of how to create a new laravel application via the laravel command.
-> Artisan File and MAMP. There appears to be some confusion here. To state you are running it in MAMP and not locally is incorrect. MAMP is a one-click solution for Apache, Mysql, PHP, etc. However, with this said these packages are all running locally as if you installed them manually yourself. As for the artisan file. This file is created when the laravel directory is created with a fresh laravel installation (so automatic). To use the artisan file you will have to go into a terminal, cd into the laravel directory and run composer install. Once that is all done you can use the artisan file. To test it you can run:
php artisan key:generate
If you get a response that a gey was generated and what that key is, then you are good to go.
-> Valet. Since you are on a mac, I would highly recommend that you look at valet to replace MAMP. It will be a lot easier to use than MAMP (just my personal opinion). However, it doesn't come with php and mysql. So if you uninstall MAMP, use homebrew to install the latest version of PHP and Mysql (I will state here that once you install mysql via homebrew you may have to start it from the terminal). To learn more about valet go to https://laravel.com/docs/5.4/valet.
-> With all this said, if you want a fresh installation of laravel run these commands in a terminal and you should be good to go (Emphasis on should. A lot of factors involved):
composer global require "laravel/installer"
export PATH="$PATH:$HOME/.composer/vendor/bin"
laravel new project
cd ~/project
composer install
php artisan key:generate
If you are running MAMP and therefore Apache then one more command:
php artisan serve
Once this is done don't close your terminal, just go to a web browser and open http://localhost:8000.You should see your new laravel application up and running.
I hope this helps. In order for the above commands to work you will need to have all the laravel requirements installed. Which are:
So if it all worked, then kickback, open the new laravel directory in your favorite editor, and code on.
At this rate, I would recommend you switch from MAMP to something more laravel friendly like Laravel Valet check out the intro video
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community