I'm trying to make my life easier by adding a PATH so that instead of having to type in ~/.composer/vendor/bin/laravel everytime into my terminal to access the Laravel installer menu I can just type in laravel to bring up the same Laravel installer commands. I already have a .profile file that is set up to point to MAMP Pro's PHP module so I'm unsure if I have to update it with an additional line or if I should be creating a new .profile page in a different directory to allow feel or this to happen.
File is located here: ~/ as .profile
export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH
Edit: I currently have composer residing in my ~/usr/bin/composer directory because when I put it inside of the ~/usr/local/bin/composer directory I cannot type composer commands it says they don't exist. I am running on a OS X Mavericks installation on my Mac. With composer in the directory it currently is in I am able to run composer commands. I have a .profile file that has the above path inside it pointing to Mamp's PHP installation. I'm wanting to be able to just type in "laravel" into my terminal to get the Laravel installation tool but instead of having to type in
~/.composer/vendor/bin/laravel everytime so I saw on a video that you have to add a path but everytime I do it overwrites that one I already have.
Is there any additional ideas that pertain to the exporting situation.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Remove your current composer.phar or composer file and run the two commands above.
If you're still getting command not found, something is wrong with your operating system.
Related
I started looking into using composer for my php project. i have MAMP Pro and would like to continue to use that for my development hosting. The problem is that I can't get composer to run anywhere accept in my /Users/***/ folder (where it runs really well). How would I get it to run in the root of my MAMP Server? I have messed with the .bash_profile file adding the following lines:
alias composer='php composer.phar'
export PATH=/Applications/MAMP/bin/php/php7.0.10/bin:$PATH
That does not work (and neither does the alias). The vendor file still shows up in the /Users/***/ folder.
Any help would be greatly appreciated!
You can do a global installation:
Since Composer works with the current working directory it is possible to install it in a system wide way.
1.Change into a directory in your path like cd /usr/local/bin
2.Get Composer curl -sS https://getcomposer.org/installer | php
3.Make the phar executable chmod a+x composer.phar
4.Change into a project directory cd /path/to/my/project
5.Use Composer as you normally would composer.phar install
Update: Sometimes you can't or don't want to download at /usr/local/bin (some have experienced user permissions issues or restricted access), in this case you can try this
Open terminal
curl -sS http://getcomposer.org/installer | php -- --filename=composer
chmod a+x composer
sudo mv composer /usr/local/bin/composer
Ok after looking at it a little bit more here's what I figured out using #Lokesh Gamot's answer and the composer site. Again, this is geared to use with MAMP.
Find the path of your development server. I would suggest putting var_dump(getcwd()); at the top of your index.php file to get the path to show up on your index page. For me, it was /Applications/MAMP/htdocs/.../web-root
Because I wanted composer in my server root, I inputted cd "/Applications/MAMP/htdocs/" into the terminal.
I then downloaded the file using curl -sS https://getcomposer.org/installer | php -- --filename=composer. This installs Composer into "/Applications/MAMP/htdocs/" as a file named composer.
When I begin a new project, I have to move the composer file into the project root using mv composer "/Applications/MAMP/htdocs/*Destination Root*" and then navigate the terminal to that same root by using: cd "/Applications/MAMP/htdocs/*Destination Root*". What I was missing was needing to move the composer file around to each root when I needed it.
After that, I can use composer using php composer. Again, thanks!
I'm following this tutorial. I need to install Laravel but I can not get pass through Composer.
Running a line like curl -sS https://getcomposer.org/installer | php is relatively easy.
I also moved it: sudo mv composer.phar /usr/local/bin/composer. I have added the PATH (export PATH="$PATH:~/.composer/vendor/bin”) by editing my .bash_profile, but no results. I can't get it to work.
Is there anyone who knows how to install composer properly?
Did you execute command?
export ~/.bash_profile
after editing this file (also reboot can be as alternative)?
Of course as quick hack you can use either php ~/.composer/vendor/bin/composer
or write hardcoded alias in ~/.bash_profile:
alias composer="~/.composer/vendor/bin/composer"
and after editing do not forget to execute export ~/.bash_profile
also check permissions if your current user can execute this file
I really appreciate all the answers above. They all helped to a final answer.
It seems that creating an alias inside the .bash_profile with the right path was solution. As of right now I can type "composer" and it will run.
The route points directly to where my composer.phar is currently installed.
A reboot was necessary as well.
alias composer="usr/local/bin/composer/composer.phar"
I m new to php and rabbitmq in debian(Linux). I have installed xampp, rabbitmq and also installed composer.phar in project directory using below command
/opt/lampp/htdocs/rabbitmq_demo# curl -s https://getcomposer.org/installer | /opt/lampp/bin/php
Now I use Composer to install the dependencies of the project using below command
composer.phar install
but it thrown an error as below
bash: php: command not found
I have preferred the link https://getcomposer.org/doc/00-intro.md
I want to prepare autoload.php
Please help me to create autoload under vendor directory.
You do not have a php cli program installed on your computer or it is not in your current $PATH variable. Please install PHP first or correct your $PATH environment variable.
Once you have this, run the composer.phar install again. This will download all dependencies listed in your composer.json file. Once the program completes, you will have a file ``vendor/autoload.php`. You can just require this file at the beginning of your own script and everything will be taken care of.
You need to add the path to the PHP command line (CLI) in the XAMPP install, to your bash environment. (You'd think the installer would do this!)
The XAMPP PHP CLI on Debian is at /opt/lampp/bin/php
So you need to add /opt/lampp/bin to your $PATH environment variable.
See this answer for the various options in modifying your path depending on who you want to be able to run PHP.
/etc/login.defs
/etc/environment
/etc/profile
~/.bashrc
In one of those files, you append to the path thus:
PATH=$PATH:/opt/lampp/bin
and re-login.
I'm getting an error saying:
failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env.
'git' is not recognized as and internal or external command, operable program or batch file
when I try and run composer create-project laravel/laravel learning-laravel.
I installed the git GUI which also comes with a command line shell, but I don't know why its not recognising the command (I'm issuing the create-project command in the normal windows command line prompt).
I also tried running the command from the git shell, which worked, but when I tried php artisan serve it gave me an error saying CLI has stopped working.
Does anyone know how to fix the git error? I'd rather use the windows command shell instead of the git one as it can then go into my wamp/www file
You need to add the directory you installed git to to your PATH environment variable.
Right click on Computer.
Click Advanced System Settings
Click Environment Variables inside the Advanced Menu
Under System Variables, scroll to PATH
Add ;"C:\path\to\git\bin";"C:\path\to\git\cmd"
Test the git command in the command prompt to see if it worked. Git is usually located in Program Files or Program Files(x86).
There is an easier (but temporal) way to add a path variable in Windows.
Paste this in your command prompt:
SET PATH=%PATH%;C:\Program Files\Git\bin
This will work for the rest of the command prompt session. Don't forget installing Git before this.
You'll need to add git to your system PATH if you want to use it in regular command prompt.
Here's a guide on modifying your system path in Windows:
http://www.computerhope.com/issues/ch000549.htm
you need to uninstall git and reinstall ( or update ) in the options you need to change from git bash only to allow git to be added to command line as well, also since it then adds it to your path you may or may not need to restart your computer
I was having some issues using git on Windows. I found this information only and it worked for me.
http://ccn.ucla.edu/wiki/index.php/Setting_Up_and_Using_Git#Windows
PHP API using: https://github.com/sandeepshetty/shopify_api
I have PHP 5.3.27 installed
I installed Composer (by going to
the website and using their install.exe)
It mentions that
"This will download shopify_api into the
vendor/sandeepshetty/shopify_api directory."
But I do not see the folders or files anywhere on the computer.
The plugin author is saying that if you download Composer with the instructions he provided (via Terminal), then Composer will autoload those files for you. Unfortunately, though easier, simply going to the source URL for the Composer tool won't do that for you.
First, make sure you have created the composer.json file and stored it in your project directory. Then, log into your server or system via the command line (Terminal for Mac OS, Putty for Windows). Cd into your project directory, and install by entering these commands:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install