Everytime I update composer I have to enter a Token generated on github.
I use this plugin to install bower packages.
This happened after github.com/RamonSmit/Nestable.git became a private repo.
I removed all references to this repo.
But I still get the message:
Your GitHub credentials are required to fetch private repository metadata (git://github.com/RamonSmit/Nestable.git)
Head to https://github.com/settings/tokens/new?scopes=repo&description=...
to retrieve a token. It will be stored in "..." for future use by Composer.
Token (hidden):
I updated composer and composer-asset-plugin to the latest version and cleared the cache.
This also didn't work:
composer config --global github-oauth.github.com xxx
How can I get rid of this unnecessary message?
Output of composer diag:
Checking composer.json: FAIL
require.yiisoft/yii2 : unbound version constraints (>=2.0.6) should be avoided
require.yiisoft/yii2-bootstrap : unbound version constraints (*) should be avoided
require.yiisoft/yii2-swiftmailer : unbound version constraints (*) should be avoided
require.fishvision/yii2-migrate : unbound version constraints (*) should be avoided
require.infoweb-internet-solutions/yii2-cms : unbound version constraints (*) should be avoided
require.bower-asset/matchHeight : unbound version constraints (#stable) should be avoided
require.infoweb-internet-solutions/yii2-news : unbound version constraints (*) should be avoided
require.infoweb-internet-solutions/yii2-action : unbound version constraints (*) should be avoided
require.infoweb-internet-solutions/yii2-member : unbound version constraints (*) should be avoided
require.dragonjet/yii2-opengraph : unbound version constraints (*) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: xxx
Dev Public Key Fingerprint: xxx
OK
Checking composer version: OK
auth.json: (located in C:\Users\User\AppData\Roaming\Composer)
{
"github-oauth": {
"github.com": "xxx"
},
"http-basic": {
"bitbucket.org": {
"username": "xxx",
"password": "xxx"
}
}
}
composer global show -i
Changed current directory to C:/Users/Ruben/AppData/Roaming/Composer
fxp/composer-asset-plugin v1.1.1 NPM/Bower Dependency Manager for Composer
composer.json:
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": [
"yii2",
"framework",
"advanced",
"project template"
],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.6",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"fishvision/yii2-migrate": "*",
"infoweb-internet-solutions/yii2-cms": "*",
"bower-asset/matchHeight": "#stable",
"infoweb-internet-solutions/yii2-news": "*",
"infoweb-internet-solutions/yii2-action": "*",
"infoweb-internet-solutions/yii2-member": "*",
"dragonjet/yii2-opengraph": "*",
"infoweb-internet-solutions/yii2-image-gallery": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800,
"preferred-install": "source"
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/infoweb-internet-solutions/yii2-i18n-module"
},
{
"type": "vcs",
"url": "https://github.com/infoweb-internet-solutions/yii2-ckeditor"
},
{
"type": "vcs",
"url": "git#bitbucket.org:infoweb-internet-solutions/yii2-news.git"
},
{
"type": "vcs",
"url": "git#bitbucket.org:infoweb-internet-solutions/yii2-action.git"
},
{
"type": "vcs",
"url": "git#bitbucket-infoweb:infoweb-internet-solutions/yii2-member.git"
}
]
}
composer.lock
You should generate new tokens on github
Settings \ Developer settings \ Personal access tokens
Note the token can also be added manually to the composer.json file:
{
"require": {
"infoweb-internet-solutions/yii2-action": "*",
},
"config": {
"github-oauth": {
"github.com": "your long token"
}
},
"repositories": [
{
"type": "vcs",
"url": "git#bitbucket.org:infoweb-internet-solutions/yii2-action.git"
},
]
}
However, if you're committing the file to a VCS repository, you may not want to include the credentials in the file. In that case, you can use the COMPOSER_AUTH environment variable to pass the same information.
export COMPOSER_AUTH='{"github-oauth":{"github.com": "your long token"}}'
composer update
Delete composer.lock file.
Then delete the vendor folder and run composer again to install all the packages.
Related
I have created a custom package which is set up in a GIT repo. Composer is successfully pulling the files into a directory in the vendor directory, but I need to pull in the nested dependencies, which I cannot find the answer on how to make this happy.
This the Composer file for the main site pulling the package:
{
"name": "development/project",
"type" : "project",
"repositories": [
{
"type":"composer",
"url":"https://wpackagist.org"
},
{
"type": "package",
"package": {
"name": "development/package",
"version": "0.0.1",
"source": {
"type": "git",
"url": "https://developer#bitbucket.org/development/package.git",
"reference" : "v0.0.1"
}
}
},
],
"require": {
"php": ">=5.4",
"composer/installers": "~1.0",
},
"require-dev": {
"development/package": "~0.0"
}
}
And here is the Composer file local to the package itself:
{
"name": "development/package",
"type" : "project",
"require": {
"php": ">=5.4",
"composer/installers": "~1.0"
},
"require": {
"ellislab/codeigniter": "~3.0"
},
}
So what I would like to have happen is that when I run Composer on the main site it pulls in the 'development/package' (which it is currently doing), but also pull in the package dependencies 'ellislab/codeigniter'. Thanks for any help on this.
You have invalid composer json in your local package, it should be like this (no double require node):
{
"name": "development/package",
"type" : "project",
"require": {
"php": ">=5.4",
"composer/installers": "~1.0",
"ellislab/codeigniter": "~3.0"
}
}
Composer automatically pulls all packages defined in require node of root package, and in require node of each dependent packages, including your ellislab/codeigniter in your development/package.
I have two projects. One is my application and the second one is an external module that I want to use in future apps.
I have created my external module on GitHub and included in the composer.json of my application.
My external module gets downloaded / cloned but the required dependencies are not installed by composer.
Here's composer.json of my application:
{
"name": "application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.5",
"zendframework/zendframework": "2.*",
"zf-commons/zfc-user": "1.4.4",
"doctrine/doctrine-orm-module": "~0.9.2",
"zf-commons/zfc-user-doctrine-orm": "1.0.*",
"zendframework/zend-developer-tools": "^0.0.2",
"username/GlideUser": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/username/GlideUser.git"
}
]
}
Here's composer.json of my external module:
{
"name": "username/glide-user",
"description": "Module For Zend Framework 2",
"type": "library",
"license": "BSD-3-Clause",
"homepage": "https://github.com/username/GlideUser",
"keywords": [
"zf2",
"zfc-user",
"bjyauthorize"
],
"authors": [
{
"name": "Haris Mehmood",
"email": "abc#outlook.com",
"homepage": "abc.com",
"role": "Developer"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.3.3",
"bjyoungblood/bjy-authorize": "1.4.0"
},
"autoload": {
"psr-0": {
"GlideUser\\": "src/"
}
}
}
When I run composer install or composer update I expect bjyauthorize package to gets installed, but composer ignore the dependency and install everything else.
What is it that I am doing wrong here.
Try updating the following line in your application composer.json from:
"username/GlideUser": "dev-master"
to:
"username/glide-user": "dev-master"
This way, what is being required matches the name of the external module, which is the name defined inside the external module's composer.json.
Although it does not look directly applicable to the dependencies of the external module not installing, it could be the cause.
i currently ran into a problem with renaming a project in composer.json.
the previos status was like the following:
{
"name": "old/name",
"license": "Business",
"type": "library",
"description": "description",
"autoload": {},
"minimum-stability":"dev",
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"sensio/generator-bundle": "~2.5",
"phpunit/phpunit": "~4.6",
"mockery/mockery": "0.9.4",
"leaphub/phpcs-symfony2-standard": "~2.0.0"
},
"scripts": {
},
"extra": {
},
"branch-alias": {
"dev-master": "2.6-dev",
}
}
}
now i need to change this to
{
"name": "new/name",
"license": "Business",
"type": "library",
"description": "description",
....
}
therefore i created a new branch, changed the information, created a branch-alias to reference it in the target-project.
...
"repositories": [
{
"type": "vcs",
"url": "git#github.com:matthias-chlechowitz/forked-repo.git"
}
],
"require": {
"new/name":"dev-matthias/rewrite-branchname"
}
...
but when running composer update to fetch the updated version, the old version with the previous project name is fetched and the following error message appears:
Problem 1
- The requested package new/name could not be found in any version, there may be a typo in the package name.
so it's not possible to rename projects within one repo or even forks? or am i missing a major part?
best regards,
matthias
thank you for your answer, but referencing a new branch was not the problem (which was working perfectly fine). The problem was really changing the name of the project (name-property in the composer.json).
According to Christophe Coevoet [1], composer always fetches the name from the master branch, so my changes in forked or derived branches doesn't affect the outcome.
Best regards,
Matthias
[1] https://github.com/composer/composer/issues/4677
I'm trying to install this github repo to my project (running on codeigniter). The steps I'm doing is very simple:
{
"name": "project",
"description": "",
"license": "MIT",
"require": {
"php" : ">=5.3.0",
"blockchain/blockchain" : "1.*",
"ext-curl": "*"
},
"require-dev": {
}
} // composer.json
and run php composer.phar update. So the package installs but I can't use it in my project - I don't think its autoloaded. /vendor/autoload.php is required in my index.php. When I try it with different package for test purposes (kriswallsmith/buzz) - it works. So what I'm doing wrong?
Also I checked my vendor/composer/installed.json and I see this:
[
{
"name": "blockchain/blockchain",
"version": "v1.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/blockchain/api-v1-client-php.git",
"reference": "c219b9b00778cf6c025628bd34fd6543922fe81b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/blockchain/api-v1-client-php/zipball/c219b9b00778cf6c025628bd34fd6543$
"reference": "c219b9b00778cf6c025628bd34fd6543922fe81b",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.3.0"
},
"time": "2015-02-03 18:34:11",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Blockchain\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Blockchain API client library",
"homepage": "https://github.com/blockchain/api-v1-client-php",
"keywords": [
"bitcoin",
"blockchain"
]
}
]
and my function where I'm trying to use this lib:
private function __check_btc_balance()
{
error_reporting(E_ALL);
$Blockchain = new \Blockchain\Blockchain(PAYMENTS_BTC_API_CODE);
}
Have you followed the installation steps?
Basically there are some differences from common composer packages. Over here it says download the source code and run composer install from it's own folder
Then include the autoloader file from the folder of the downloaded files so you will have somewhere a folder Blockchain/vendor/autoload.php to include
Download the source or clone the repository. This php library works
with the Composer package manager. Navigate to the root of the
repository and run
$ composer install
This will create the /vendor folder in the repository root. In the php
source, simply:
// Include the autoload.php from its vendor directory require
'vendor/autoload.php'
// Create the base Blockchain class instance
I've seen ...
"autoload": {
"psr-4": {
"Blockchain\\": "src/"
}
},
I always keep all my code in src\Vendor\Project\Filename.php and composer autoloader works with this. Try to add this lines of code:
"autoload": {
"psr-0": {
"": "src/"
}
},
Can someone explain how I'm supposed to use composer with a php. I have a composer.json file in my doc root that downloads the core packages for my project, but then when I want to add another project like google+ php sdk found here https://github.com/googleplus/gplus-quickstart-php/
what do I do with that composer.json file? do i combine them manually? Do I just download that composer.json into a different dir?
my current composer.json file looks like this
{
"name": "fuel/fuel",
"type": "metapackage",
"description": "The FuelPHP framework",
"keywords": ["framework"],
"homepage": "http://fuelphp.com",
"license": "MIT",
"authors": [
{
"name": "FuelPHP Development Team",
"email": "team#fuelphp.com"
}
],
"support": {
"irc": "irc://irc.freenode.org/fuelphp",
"forum": "http://fuelphp.com/forums"
},
"require": {
"php": ">=5.3.3",
"monolog/monolog": "1.5.*",
"fuelphp/upload": "2.0",
"omissis/php-cloudfiles": "dev-master",
"mustache/mustache": "*"
},
"suggest": {
"mustache/mustache": "Allow Mustache templating with the Parser package",
"smarty/smarty": "Allow Smarty templating with the Parser package",
"twig/twig": "Allow Twig templating with the Parser package",
"mthaml/mthaml": "Allow Haml templating with Twig supports with the Parser package"
},
"config": {
"vendor-dir": "fuel/vendor"
},
"minimum-stability": "dev"
}
The g+ composer.json file looks like
{
"name": "googleplus/quickstart",
"description": "This quick-start app is built in PHP and lets you get started with the Google+ platform in a few minutes.",
"license": "Apache-2.0",
"repositories": [
{
"type": "package",
"package": {
"name": "google/google-api-php-client",
"version": "0.6.2",
"dist": {
"url": "http://google-api-php-client.googlecode.com/files/google-api-php-client-0.6.2.tar.gz",
"type": "tar"
},
"autoload": {
"classmap": [
"src/"
]
}
}
}
],
"require": {
"silex/silex": "1.0.*#dev",
"twig/twig": ">=1.8,<2.0-dev",
"google/google-api-php-client": "0.6.2"
}
}
Simply add this into the require block of your original composer file:
"googleplus/quickstart": "*",
I have little experience with Composer, but I can tell you that when you require a lib, you add that lib to your main composer.json file. Upon installation or update, the new lib will be downloaded and its composer.json file will be read by Composer; its dependencies will be automatically downloaded, and so on.
So we could say you're not supposed to download your requirements manually, you have to use Composer for that, it will take care of it for you.