understanding composer require & its remote location - composer-php

i have this in composer.json and i am trying to undersntad which file it is pulling. its tinipng magento extension code
i can understand that its requesting version greater than 1.5 and here in github i can see version 1.5.2 but github link how it is added. its not just github.com/tinify/tinify
https://github.com/tinify/tinify-php/releases/tag/1.5.2
so magento is pulling require field from some other place or some link in require field ??
"minimum-stability": "alpha",
"require": {
"php": ">=5.5.0",
"ext-curl": "*",
"ext-json": "*",
"tinify/tinify": ">=1.5"
},

i am sorry. coposer documentation is right place.
this question all answers are in https://getcomposer.org/doc/03-cli.md
got the answer

Related

Why I can't use composer require {packageName} successfully?

I'm learn how to create Laravel packages, And I wrote a package here: noahprot/fillindata
Then I submit it to packagist
And I have set a lastest release in github
And the Packagist show like this:
Already show the latest release
Then I use Laravel CLI Tool create a new laravel project, I want try to use this package, and I use composer require noahprot/fillindata
But the result like this:
[InvalidArgumentException]
Could not find a version of package noahprot/fillindata matching your
minimum-stability (dev). Require it with an explicit version con
straint allowing its desired stability.
my package's composer.json file like this:
{
"name": "noahprot/fillindata",
"License": "MIT",
"description": "take the csv file fill into database table",
"authors": [
{
"name": "Noah Prot",
"email": "mylovewangjian#gmail.com"
}
],
"autoload": {
"psr-4": {
"NeoLee\\Fillindata\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"NoahProt\\Fillindata\\FillindataServiceProvider"
]
}
},
"require": {}
}
I make some try like:
add "minimum-stability": "dev" to composer.json, but failed,
even I edit to "stable", but failed too;
I have no idea for this situation now;
Guys, Please Help me, and give some advice, please!
Thank you everyone!
It seems that Packagist have some cache-related problems, see this issue. Mirror you're using probably have some outdated packages info. At this point you can do only two things:
Wait until packages data on mirror will be refreshed.
Report your case (see this comment).

Installing Omnipay/payu with laravel 5.1

I am developing a website using Laravel 5.1 and i need to have a shopping cart set up, i am trying to install Omnipay for this, i have selected three gateways i will be using: Paypal, Stripe and PayU.
My require under composer.json looks like this:
"require": {
...
"ignited/laravel-omnipay": "2.*",
"omnipay/paypal": "*",
"omnipay/stripe": "*",
"omnipay/payu": "*"
},
And i am getting error on the payu part alone, this is the error:
The requested package omnipay/payu * is satisfiable by omnipay/payu[dev-master, 2.0.x-dev] but these conflict with your requirements or minimum-stability.
I read on another post that specifying "prefer-stable": true, and "minimum-stability": "dev" into the config part of the composer.json would fix the issue but its not working for me, any tips?
Solved it by adding "prefer-stable": true, "minimum-stability": "dev" under the config part of the composer.json, NOT inside it, as i stated in the post.
Like so:
...
"config": {
"preferred-install": "dist"
},
"prefer-stable": true,
"minimum-stability": "dev"
...

packagist / composer - Assign a version number

I have people using my pacakgist library.
I want to make sure that their composer.json version requirement stated as "dev-master" will not get updated when they run composer update... as I have changed the underlying architecture of the package.
How do I assign a new versioning to my new update? so that they have to explicitly say I want v1.01
I currently have the composer.json as:
{
"name": ...,
"type": "library",
"description": ...,
"keywords": ...
"homepage": ...,
"license": "MIT",
"authors": [
...
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": ["Models/"]
}
}
The composer documentation recommends specifying the version using a VCS tag. With git this looks like
git tag -a 1.0.0 -m 'Your tag message'
This will tag the HEAD of your current branch with the version 1.0.0. Then do
git push --tags
Once your package gets crawled again, the version should be available on packagist.

Yii2 Error: yii\base\UnknownMethodException: Calling unknown method: yii\web\UrlManager::addRules()

After todays update of composer dependencies (with composer update command) my Yii2 application became broken - It throws Unknown Method – yii\base\UnknownMethodException: Calling unknown method: yii\web\UrlManager::addRules()
After inspecting vendor/yiisoft/yii2/web/UrlManager.php file I found that there is no method addRule.
And the whole entire class UrlManager is different from the class in the repository.
My composer.json:
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"yiisoft/yii2-gii": "2.0.0-beta",
"claudejanz/yii2-mygii": "*",
"kartik-v/yii2-grid": "dev-master",
"kartik-v/yii2-builder": "dev-master",
"2amigos/yii2-switch-widget": "*",
"yiisoft/yii2-jui": "*",
"DsXack/yii2-underscore": "*",
"2amigos/yii2-editable-widget": "*",
"warrence/yii2-kartikgii": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*"
},
I think they have changed the way some libraries are loaded through composer.
To solve it:
Add to composer.json
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
and run:
# php composer.phar global require "fxp/composer-asset-plugin:1.0.*#dev"
# php composer.phar update --dev
More info: Issue on Github and Issue on Github
Full credit to: #githubjeka and #SonicGD
Here is an explaination of why this happened:
I think this is again the composer dependency resolver doing unexpected things:
you require yiisoft/yii2 in your composer.json but do not have the composer asset plugin installed.
then the dependency resolver does not find packages with vendor bower-asset so it looks for other versions of yiisoft/yii2 that do not have conflict
The result is to install the beta version of yii2 to be installed
The correct solution as already mentioned is to install the composer-asset-plugin:
php composer.phar global require "fxp/composer-asset-plugin:1.0.*#dev"
It seems the update went totally wrong, since the files are different from the ones on github - several functions missing.
What i had to do to get "rid" of this error:
Copy the code from the repository in your local files:
https://github.com/yiisoft/yii2/blob/master/framework/web/UrlManager.php
https://raw.githubusercontent.com/yiisoft/yii2/master/framework/helpers/BaseHtml.php
This solved it for the moment for me.
Like ricardgf says, read this:
https://github.com/yiisoft/yii2/blob/master/docs/guide/start-installation.md
then run:
composer.phar global require "fxp/composer-asset-plugin:1.0.*#dev"
and
composer.phar update --prefer-source --no-interaction
ok I solved the problem installing yii2 in this way :
composer global require "fxp/composer-asset-plugin:1.0.*#dev"
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
Try to update your composer.json into following way:
"require": {
"yiisoft/yii2": "*"
},
in project directory, write this command-
php composer.phar update

How to get list of all installed packages along with version in composer?

I have been working on a project using Symfony 2.1 on my local machine. I have uploaded it to my server but when I try and install the vendor bundles using Composer, I'm getting a lot of dependency errors. Presumably this is something to do with the latest version of Symfony just being released and my composer.json file not specifying exact version numbers.
Is there any way I can quickly display the version numbers of everything on my local machine?
Here is my composer.json file (which worked fine until a few days ago):
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"sonata-project/admin-bundle": "*",
"sonata-project/cache-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"stof/doctrine-extensions-bundle": "1.1.x-dev",
"sonata-project/user-bundle": "dev-master",
"sonata-project/easy-extends-bundle": "dev-master",
"friendsofsymfony/user-bundle": "2.0.x-dev",
"friendsofsymfony/jsrouting-bundle": "*",
"liip/imagine-bundle": "*",
"simplethings/form-extra-bundle": "dev-master",
"antimattr/google-bundle": "dev-master",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"genemu/form-bundle": "2.1.*",
"behat/behat": "2.4.*#stable",
"behat/mink": "1.4.*#stable",
"behat/symfony2-extension": "*#stable",
"behat/mink-extension": "*#stable",
"behat/mink-selenium2-driver": "*#stable",
"behat/mink-browserkit-driver": "*",
"liip/functional-test-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
},
"config": {
"bin-dir": "bin/"
}
}
You can run composer show -i (short for --installed).
In the latest version just use composer show.
The -i options has been deprecated.
You can also use the global instalation of composer: composer global show
To list the globally installed composer packages:
composer global show -i
List installed dependencies:
Flat: composer show -i
Tree: composer show -i -t
-i short for --installed.
-t short for --tree.
ref: https://getcomposer.org/doc/03-cli.md#show
If you only want to check version for only one, you can do
composer show -- twig/twig
Note that only installed packages are shown by default now, and installed option is now deprecated.
The behaviour of this command as been modified so you don't have to pass the -i option:
[10:19:05] coil#coil:~/workspace/api$ composer show -i
You are using the deprecated option "installed".
Only installed packages are shown by default now.
The --all option can be used to show all packages.
Ivan's answer above is good:
composer global show -i
Added info: if you get a message somewhat like:
Composer could not find a composer.json file in ~/.composer
...you might have no packages installed yet. If so, you can ignore the next part of the message containing:
... please create a composer.json file ...
...as once you install a package the message will go away.
With composer-runtime-api 2.0+ there is a new InstalledVersions class with some static methods to see things programmatically.
For example:
// To list all packages (`string[]`)
\Composer\InstalledVersions::getInstalledPackages();
// To list every details of every packages
\Composer\InstalledVersions::getAllRawData();
More information: https://getcomposer.org/doc/07-runtime.md#installed-versions
If you want to install Symfony2.2, you can see the complete change in your composer.json on the Symfony blog.
Just update your file according to that and run composer update after that. That will install all new dependencies and Symfony2.2 on your project.
If you don't want to update to Symfony2.2, but have dependency errors, you should post these, so we can help you further.
Is there a way to get it via $event->getComposer()->getRepositoryManager()->getAllPackages()

Resources