After adding a composer package which needs mongodb 3.0 and because mongodb 3.0 needs php7, finally code after deployment failed on production, I found out my current composer.json configuration needs php7. How can I run a command and find out minimum requirements of my composer.json file? Something like:
composer requirements
# or
composer requirements-dev
Try
composer show --installed --tree
Or the shorthand
composer show -i -t
Related
I try to install new laravel app on fresh ubuntu installation, but I got error :
master#master-laptop:/mnt/_work_sdb8/wwwroot/lar$ composer global require "laravel/installer=~1.1"
Changed current directory to /home/master/.config/composer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
13 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
master#master-laptop:/mnt/_work_sdb8/wwwroot/lar$ export PATH="$PATH:~/.composer/vendor/bin"
master#master-laptop:/mnt/_work_sdb8/wwwroot/lar$ laravel new NewLivewireApp --jet
laravel: command not found
Why I got error ? Is 1.1 valid installation for mopdern laravel app?
Thanks!
you must add a composer autoloader to your OS path.
add this code to the end if you are using Linux.
export PATH="$HOME/.composer/vendor/bin:$PATH"
File:
~/.bashrc or ~/.zshrc
I find it easier to just use composers built in installer, which i use on a regularly basis.
composer create-project laravel/laravel your-app
composer create-project foo/bar command creates a new project from packagist.org
composer require foo/bar gets the module(library) from packagist.org
so you should use
composer create-project laravel/laravel mylaravelproject
for detail look at this link
https://packagist.org/packages/laravel/laravel
composer global require laravel/installer
laravel new example-app
I salved the issue with commands :
nano ~/.bash_profile
export PATH=~/.composer/vendor/bin:$PATH
source ~/.bash_profile
and it works for me !
What is the difference between composer and composer.phar?
Example:
composer install
composer.phar install
Is there a reason why I keep seeing code writen using composer.phar all the time when composer does the same?
There is no difference - composer.phar is the executable and composer can be an alias or symlink for it, depending on the way you've installed composer. As rob006 pointed out, there can be multiple ways to install composer: the official documentation at https://getcomposer.org/doc/00-intro.md#globally recommends to move the downloaded PHAR file to /usr/local/bin/composer which will make it callable through composer for all users of your system.
If you would move the file to another destination, like /usr/local/bin/composer.phar, the same composer binary would be available under that different command composer.phar.
And finally, if you would not have the chance to install composer globally, you could put it under either name in any local place
i'm tryng to install intervation image in my laravel project 5.2, i'm tryng install by composer like this:
$ php composer.phar require intervention/image
but composer give me an error like the image:
i don't know why, there other way to install it? or fix this issue?
thank you for your support!
Step 1
First type composer in you command prompt, check if composer is installed or not. you should see something like that.
If this is there then composer is installed goto Step 2 , otherwise install the composer from here
Step 2
For intervention image
go to your root directory of laravel project
run command composer require intervention/image
It will download the latest version of composer
after installing go to your config/app.php
in provider array add
Intervention\Image\ImageServiceProvider::class
in alias array add
'Image' => Intervention\Image\Facades\Image::class
after installing run command php artisan config:publish
it will copy the intervention config file to your config directory.
Hope this will help.
No need of adding $ at the beginning.
Just use:
php composer.phar require intervention/image
$ in documentation indicates that the command is to be run in a terminal ( usually Linux ).
Add this line to your composer.json, then run composer update.
"intervention/image": "2.*"
I'm new to Yii2, I'm trying to install yii2 application advanced template.
I did follow these steps:
1 - Download yii2-app-advanced zip file from https://github.com/yiisoft/yii2-app-advanced
Follow GETTING STARTED guide:
My vendor directory Show Empty.
Please help, thanks in advance
Installing via Composer
If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
On Windows, you'll download and run Composer-Setup.exe.
Please refer to the Composer Documentation if you encounter any problems or want to learn more about Composer usage.
If you had Composer already installed before, make sure you use an up to date version. You can update Composer by running composer self-update.
With Composer installed, you can install Yii by running the following commands under a Web-accessible folder:
composer global require "fxp/composer-asset-plugin:~1.0.3"
composer create-project --prefer-dist yiisoft/yii2-app-advanced basic
The first command installs the composer asset plugin which allows managing bower and npm package dependencies through Composer. You only need to run this command once for all. The second command installs Yii in a directory named basic. You can choose a different directory name if you want.
Note: During the installation Composer may ask for your Github login credentials. This is normal because Composer needs to get enough API rate-limit to retrieve the dependent package information from Github. For more details, please refer to the Composer documentation.
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced basic
Yii2 Installation Following command:
(1) First install Composer (LINUX):
Locally:
curl -sS https://getcomposer.org/installer | php
OR
(1) First install Composer (WINDOWS):
C:\Users\username>cd C:\bin
C:\bin>php -r "readfile('https://getcomposer.org/installer');" | php
Note: If the above fails due to readfile, use the http url or enable php_openssl.dll in php.ini
C:\bin>echo #php "%~dp0composer.phar" %>composer.bat*
C:\Users\username>composer -V
Composer version 27d8904
(2) Yii2 framework online downloads:
Basic App:
php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.0-beta
Advanced App:
php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.0-beta
(3) Other App Settings Command:
php init
php yii migrate
Refrence
use composer cos you need composer in future too!
and after unzip the advance project in www or htdocs you should navigate to your project with cmd or terminal and type yii migrate after that again type composer update
I have installed CakePHP 3.0 using Composer on my PC (Ubuntu). I want to update the changes of CakePHP 3.0.
I have used the following link provided at CakePHP docs after changing the required package, but I am getting the below error in the terminal:
ubuntu#ubuntu:~$ php composer.phar update Composer could not find a
composer.json file in /home/ubuntu To initialize a project, please
create a composer.json file as described in the
http://getcomposer.org/ "Getting Started" section
Could you please provide a proper suggestion?
Note: I have the composer.json file in the project directory, so what should I do in that case?
you should issue that command in the project directory, where composer.phar and composer.json should be present. So cd /var/www/html/cake_project first.
You can set environment path to use composer in command line or you only need copy file composer.phar into your project folder and then cd into you project folder.
Finally, you run command php composer.phar update
Composer that will auto update CakePHP latest version.
http://rao5s.vn