Update global composer on Ubuntu 16.04 - composer-php

I'm trying to update the global composer but I can't do it.
I think I can do composer init and then make php composer.phar update but I prefer to update the global composer. If I run the latter, I get:
composer could not find a composer.json file
How can I make it? I try to find the composer files of installation and I can't find them and also I try to find information using composer but nothing.

Related

how to install illuminate/mail via composer in Lumen

A setting mail-in on lumen project, I should install illuminate\mail via composer, but show me an error:
Your requirements could not be resolved to an installable set of packages
You can install through composer using the following command in the terminal:
composer require illuminate/mail
Make sure you are in the project directory.

Intervention Image - Could not open input file: composer.phar

When I install the php composer.phar require intervention/image this,
I got the one error:
Could not open input file: composer.phar
I follow this step but I can't find the solution to my error: Intervention Image
To install the most recent version, run the following command
composer require intervention/image
OR
Add to composer.json file:
"require": {
"intervention/image": "^2.5",
},
After, Run this command in the command prompt: composer update
More info: intervention/image
use just
composer require intervention/image
instead of
php composer.phar require intervention/image
If you added composer to your system environment variables. you can call composer globally like this:
composer require intervention/image
How to add composer to system environment variables
Search "Edit the system environment variables" in start menu.
Click on "Environment variables"
Find "PATH" variable and edit it.
Add your composer installation folder path. C:\ProgramData\ComposerSetup\bin
Find your composer installation folder
You can find where composer is installed by this command:
which composer

How to get the required version of the Composer Plugin API?

It is necessary to do the following:
composer self-update
composer global require "fxp/composer-asset-plugin:*"
But after executing the composer self-update, an error pops up:
The "hirak/prestissimo" plugin was skipped because it requires a Plugin API version ("~1.0.0-alpha10") that does not match your Composer installation ("1.1.0"). You may need to run composer update with the "--no-plugins" option.
My current version of Composer is 1.4.2
For the same reason, the following commands do not work:
composer global require "fxp/composer-asset-plugin:*"
An error pops up:
The "hirak/prestissimo" plugin was skipped because it requires a Plugin API version ("~1.0.0-alpha10") that does not match your Composer installation ("1.1.0"). You may need to run composer update with the "--no-plugins" option.
How to get the required version of the Composer Plugin API?
You just need to update hirak/prestissimo:
composer global update hirak/prestissimo --no-plugins

installation of composer on shared hosting

I have installed composer on shared hosting.
It's successfully installed on my shared hosting.
I have followed this tutorial for installation.
Link :- https://www.globo.tech/learning-center/laravel-under-cpanel/
Screenshot after installation.
I have used below command and it's working fine for me.
php composer.phar
But when I tried to install laravel in my public_html directory using below command,
composer create-project --prefer-dist laravel/laravel borrowpet "5.2.*"
It's not working. It shows composer command not please find below screenshot for error.
Please let me know what I'm missing while installing composer.
Use the command php composer.phar create-project --prefer-dist laravel/laravel borrowpet "5.2.*"
and make sure you execute the command from the directory where compser.phar exists.

What does the different flags of Composer when creating a Laravel project?

Anyone can tell me the difference between this commands
composer create-project laravel/laravel your-project-name --prefer-dist
composer create-project laravel/laravel your-project-name
composer create-project laravel/laravel your-project-name -dev
From the documentation for composer:
--prefer-dist: Reverse of --prefer-source, composer will install from dist if possible. This can speed up installs substantially on build servers and other use cases where you typically do not run updates of the vendors. It is also a way to circumvent problems with git if you do not have a proper setup.
That means Composer will install the dependencies from the distribution build, instead of the sources.
And for the --dev flag:
--dev: Install packages listed in require-dev.
That means Composer will also install all package dependencies list in require-dev key from your composer.json. The require-dev key are dependences only required for development.
Please, for more information, read the docs regarding Composer CLI: https://getcomposer.org/doc/03-cli.md#create-project

Resources