I new in Composer. I have been searching and I have managed to install it:
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/bin/composer
If I understand the second line makes it accessible globally in my computer.
I have checked that have installed correctly as I have written composer in the terminal and it gives me a list of commands and descriptions.
Now I want to install Stripe. I follow that instructions: https://stripe.com/docs/recipes/subscription-signup#creating-the-signup-form-using-checkout
I write in the terminal: composer require stripe/stripe-php
I see they install a folder in the root of the computer (in a Mac, the house with my name) the folder: vendor/stripe
Now the Stripe instructions have a file with:
require_once('vendor/autoload.php'); If I am in MAMP how should I reach to the Stripe files with the require? How should be the link?
In your project (inside MAMP) you should run composer install. There you will see the vendor file appear and will be easier for you to track the path.
As you correctly mentioned you will require the autoload.php file which is in inside the vendor file which will appear.
Just make sure that before run the composer install that you are inside your project folder.
Related
I have installed composer by the instructions given in their site for Ubuntu 16.04. Its giving the usual output after giving the 'composer' command in the terminal.
After installing composer, I have downloaded the composer using
composer global require "laravel/installer"
Now to install Laravel, I have to add $HOME/.composer/vendor/bin in my path. But there is no .composer folder in my home directory. Can anybody tell me why this is happening ?
In my Ubuntu 16.04.4, after downloading the Laravel installer using
composer global require "laravel/installer"
I found my Laravel here :
~/.config/composer/vendor/laravel/installer/
Then I set my .bashrc using nano ~/.bashrc and export your composer config file :
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
And refresh using source ~/.bashrc in terminal
And Laravel is running, but I did not need any .composer folder as said in the Laravel official site.
This answer has helped me a lot.
I have developed a cs cart add on, But when I make a zip of it and try to upload it from gui it gives wrong structure data
so after little research I got that, I have to follow some steps of given in following url.
https://github.com/cscart/sdk
But after successful installation of composer, When I run the command
cscart-sdk command:name
It gives me error
cscart-sdk is not recognized as an internal or external command
I am very new to cscart add-on development
There seems to be something wrong with your composer install, please follow this tutorial (this is where cscart also relates to)
Installation - Linux / Unix / OSX#
Downloading the Composer Executable#
Composer offers a convenient installer that you can execute directly from the commandline. Feel free to download this file or review it on GitHub if you wish to know more about the inner workings of the installer. The source is plain PHP.
There are in short, two ways to install Composer. Locally as part of your project, or globally as a system wide executable.
Locally#
Installing Composer locally is a matter of just running the installer in your project directory. See the Download page for instructions.
The installer will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.
Now just run php composer.phar in order to run Composer.
You can install Composer to a specific directory by using the --install-dir option and additionally (re)name it as well using the --filename option. When running the installer when following the Download page instructions add the following parameters:
php composer-setup.php --install-dir=bin --filename=composer
Now just run php bin/composer in order to run Composer.
Globally#
You can place the Composer PHAR anywhere you wish. If you put it in a directory that is part of your PATH, you can access it globally. On unixy systems you can even make it executable and invoke it without directly using the php interpreter.
After running the installer following the Download page instructions you can run this to move composer.phar to a directory that is in your path:
mv composer.phar /usr/local/bin/composer
Note: If the above fails due to permissions, you may need to run it again with sudo.
Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create the directory manually before proceeding: mkdir -p /usr/local/bin.
Note: For information on changing your PATH, please read the Wikipedia article and/or use Google.
Now just run composer in order to run Composer instead of php composer.phar.
I am trying to install the yii2 and after I installed the composer I tried to run composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
it says :
Could not open input file: composer.phar
Any suggestions ?
Make sure of composer work correctly.
php composer.phar -v
Try
php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
I know probably you've figured it out by now but still I want to help.
Make your composer.phar global so you can access it from anywhere. You can set path in environment variables or you can give direct path like below:
php C:\ProgramData\ComposerSetup\bin\composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
Note: I'm using Windows 8.1 and composer is installed in C directory.
First of all install composer in your system Like windows system. you can download composer from this url https://getcomposer.org/download/. after install composer you can go to C:\composer check files for composer.phar and composer.bat files then copy both files and goto C:\xampp\php paste both files here and restart xampp then after that you can install yii2
I realize that this is what composer is used for, but I don't particularly like it. It makes sense, but it annoys me that laravel5's github doesn't work out of the box because it's vendor directory is somewhat large and isn't necessarily laravel5, although laravel does require it.
It also puzzles me why composer doesn't get it itself.
I would expect to be able to
git clone the_laravel5_github_url
composer install
and be able to run as it seemed like you were able to do at one time, but for some reason now, the vendor directory isn't there. I feel like this makes laravel harder to set up as it isn't so obvious.
Is there a place where someone can get an recent version of this? I find it disappointing that there is no mention of it on their readme and that you were able to do it before and still can't despite using composer install.
Install Composer on your OS using this command
curl -sS https://getcomposer.org/installer | php.
Move the composer.phar file to /usr/local/bin/ with this command
mv composer.phar /usr/local/bin/composer. This will enable you to access composer globally.
git clone your project.
Make a vendors folder in the root of your project.
cd to root of your project and run composer update. This command will look for vendors folder in the root and will install all the packages required by your project in it.
Happy Coding
Thank you :)
Use composer install in the same folder of your app. Try composer update. And install composer globally in your OS.
I am trying to just install composer, I am on mac osx. I have done it before using the terminal lines from their site and it worked just fine. I got a clean install on my mac now, and it won't install properly.
I tried to:
cd ~
curl -sS https://getcomposer.org/installer | php
and and:
cd /Applciations/MAMP/htdocs
curl -sS https://getcomposer.org/installer | php
and neither works. (I saw a post saying I should cd to a directory before trying to install it. But no matter what, I keep hitting this error:
Composer could not find a composer.json file in /Applications/MAMP/htdocs
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
when trying to install composer.
I think your question arises from a slight misunderstanding. Composer installs itself when you run the script provided on their Web site. No additional work to install Composer is necessary.
$ php composer.phar install is used to install packages with Composer, which are almost always listed in a JSON file named composer.json. Without this file, Composer doesn't know which packages to install and fails.
See "Declaring Dependencies" in Composer's Getting Started guide for how to generate a composer.json for your project.
In my case, I had a deprecated error being output from PHP. Apparently that causes composer to fail detecting the composer.json file.