Composer not working on command prompt Windows 7 - windows

I installed Composer via Composer windows installer and it installed to the path C:\ProgramData\ComposerSetup. The composer.phar file is in the bin folder in the directory (C:\ProgramData\ComposerSetup\bin). I have added the Composer PATH to the environment variable. But even after that, I can't make Composer get start by typing composer in the command prompt. Can you help me? I have tried installing it manually in different directories and so far no success.
I have downloaded Console2 and inside it, Composer works just fine. But the windows command prompt doesn't do anything unless I'm in the installation directory.

Related

Cannot run composer on cmd after installing it

So I've installed composer and it can't be called via cmd. Everytime I run composer via cmd command line it will show me like this :
I forgot what I did to composer command but I think it was some echo command in #php. So any ideas to solve this? Thanks
Is it in your PATH? You may need to add it to your PATH in order for it to be "found" and executed when you call composer in the command prompt.
Check out the docs here: https://getcomposer.org/doc/00-intro.md#installation-windows
UPDATE:
So I uninstalled the composer, removed the left-over directory manually at C:\Users\<user>\Composer , C:\Users\<user>\AppData\Local , C:\Users\<user>\AppData\Roaming , removed composer PATH at Environment Variables, then reinstalled it by running the ComposerSetup.exe from https://getcomposer.org , re-adding the composer PATH at Environment Variables (in my case C:\Users\<user>\composer) and it works. Composer can be called globally from cmd.

Why doesn't composer install Laravel globally in /usr/bin?

The Laravel installation guide says:
First, download the Laravel installer using Composer:
composer global require "laravel/installer"
Make sure to place the $HOME/.composer/vendor/bin directory (or the
equivalent directory for your OS) in your $PATH so the laravel
executable can be located by your system.
Why can't laravel just be installed to /usr/bin like a normal executable?
Is making a symlink instead of adding the path a good idea?
ln -s $HOME/.config/composer/vendor/bin /usr/bin/laravel
Why doesn't composer do this by default?
on MacOS 10.12 I have solve the issue.
after execute the command on terminal
composer global require "laravel/installer"
composer will install laravel/installer on your computer.
Find the location where is installed Laravel installer. Then add a line on ~/.bash_profile
export PATH=<laravel installer location>:$PATH
On my cace <laravel installer location> was /Users/shahriar/.composer/vendor/laravel/installer/bin/
So I have added the line on .bash_profile
export PATH=/Users/shahriar/.composer/vendor/laravel/installer/bin:$PATH
then type a command on terminal source ~/.bash_profile it will update your .bash_profile
and its worked. and now my Laravel installer installed globally.

composer suddenly doesn't work on cmd

I was trying to install laravel after i installed composer and made sure it's working by typing composer on my cmd but right after i added this line on cmd i became unable to see composer command working
composer global require "laravel/installer"
Now when i type composer it does nothing just like that
And here list of the current windows variables
The problem was that there was 2 files composer.phar and composer.bat inside my user folder "C:\Users\Yasser" which opens on cmd by default when i removed these 2 files i was able to use the command composer normally thanks to Peh

Installing Laravel via the Laravel installer

I have composer installed, but checking the Laravel docs, I'm struggling with:
"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal."
I'm not sure what to do here, could someone explain it to me?
Go to terminal and paste the next line:
nano ~/.bash_profile
After that paste the next line in nano:
export PATH="$PATH:$HOME/.composer/vendor/bin"
Done. Restart your terminal and enjoy laravel.
The PATH environment variable tells your system where to look when you run a command. By default ~/.composer/vendor/bin will not be in your PATH. Therefore, if you just attempt to run the command laravel after installing it via composer, your terminal will give you an error saying the command is not found. But if you use the entire path to the command (~/.composer/vendor/bin/laravel), it will execute successfully.
When you run the command composer global require "laravel/installer=~1.1", composer puts the laravel installer into the directory ~/.composer/vendor/bin (in *nix, ~ represents your home directory). Adding ~/.composer/vendor/bin to your PATH allows you to just execute the command laravel instead of having to use the full path of ~/.composer/vendor/bin/laravel.
Helpful Stuff:
How to set/change your PATH environment variable in OSX
Installing composer packages globally

Laravel 4 Installation Problems on WAMP/Windows

First,I use wamp on my Window7.I open php-openssl,and I git pull the laravel from github.com,and then I put laravel on my d:/wamp/www/, I change the c:/windows/system32.But when I open the url
http://localhost/laravel/public
I see this question.
I am a newbie on laravel,and without install on Ubuntu.Where is my wrong, without no pear,or something else? Thank you!
You need to run composer install in a command prompt.
If you do not have composer, download the phar file from their website.
Place the file you just downloaded into the laravel directory.
Then, make sure that the absolute path to php.exe is added to your PATH environment variable.
Then, you can hold down shift, and right click anywhere inside the laravel directory, and open up a command prompt window. Then, run php composer.phar install. The process may take some time, depending on the speed of your internet connection.
Instead of using the above method, you can download the Composer installer for Windows, install it, and just run composer install.
Note that you only need to do this in order to put the Laravel components together. You do not need to run it on a live server.
Please consult the Laravel Docs for installation and other instructions: http://laravel.com/docs
Try This :
Installing Laravel 4 on WAMP
1. Enable OpenSSL
OpenSSL must be enabled in the PHP configuration.
Edit php.ini in your WAMP’s PHP folder, e.g.:
C:\wamp\bin\php\php5.4.12\
Note: This is not the php.ini in C:\wamp\bin\apache\Apache2.4.4\bin.
Find the following line and remove the semicolon save it:
;extension=php_openssl.dll changed to extension=php_openssl.dll
2. Install Composer
(i).Download the Composer Windows installer from getcomposer.org.
(ii). Run the installer.
(iii). When it asks for the location of php.exe, point it to the executable in your WAMP’s PHP folder, e.g.:
C:\wamp\bin\php\php5.4.12\
(iv). Finish the installation.
(v). Open a command-line interface (cmd) and type:
composer
It should return a list of options. If you get an error, restart your computer and try again.
Composer has now been installed and added to your PATH environment variable. This means you can run it from any directory using the command-line interface.
Now we need to install Composer. This is a dependency manager that will download the latest release of Laravel and specific versions of Laravel’s dependencies, such as Doctrine and Symfony.
3.Install Laravel
Now that Composer has been installed, Composer can download and install Laravel onto your system.
(i). Open a command-line interface (cmd).
(ii). Go to the directory in which you want to install Laravel. This is usually your development directory. In this tutorial, we’ll use C:\wamp\www\laravel
(iii). Instruct Composer to install Laravel into a project directory. we use project name myproject.
composer create-project laravel/laravel myproject --prefer-dist
Note: This will install Laravel in a subdirectory myproject of the current working directory.
Three type of installation to be completed
Now your project was running directory like
C:\wamp\www\laravel\myproject\public\
After completed put tick mark and increase the point....
Do php composer.phar dump-autoload or php artisan dump-autoload

Resources