Cannot upgrade to Symfony 3 because of a dependency - symfony

I'm trying to upgrade from Symfony 2.8 to Symfony 3, but I cannot update it from Composer.
I get this error :
hellogerard/jobby dev-master requires symfony/process ^2.7 -> satisfiable by symfony/process[v2.7.0 ... blabla bla v2.8.2]
When I look the composer.json file of this library I need, I see this :
"require": {
(...)
"symfony/process": "^2.7"
},
You can find the composer file of Jobby here : https://github.com/jobbyphp/jobby/blob/master/composer.json
The problem is that in Symfony 3, the symfony/process version is 3.0, and because of the "^2.7" on Jobby's composer.json, I cannot get it. I know that there is no backwards compatibilities problems with symfony/process, so how can I do to fix / ignore that problem ?
Regards

Create your own fork and make a pull request on the base repository.
If there is no BC-break using the requested package with symfony/process:3.0,
just change the package version from ^2.7 to ^3.0 or >=2.7 in your fork's composer.json.
EDIT
Then, tell composer to use your fork for installations, like this :
"repositories": [
{
"type": "vcs",
"url": "https://github.com/yourusername/jobby"
}
],
"require": {
"hellogerard/jobby": "dev-master"
}
See VCS Repositories documentation

Related

upgrade symfony 2.8 to 3.4 using local directory

I am looking how to upgrade the framework Symfony 2.8 to 3.4 using local directory.
My development environment doesn't have access to internet.
I've followed https://getcomposer.org/doc/05-repositories.md#path
I download Symfony 3.4 and deposit it in the same directory as Synfony 2.8
Frameworks
Symfony-2.8
Symfony-3.4
Then I configured the composer.json file (symfony 2.8) like this :
"repositories": [
{
"type": "path",
"url" : "/frameworks/symfony3-4"
}
],
"require": {
"/frameworks/symfony3-4": "*"
},
When I try the update :
Composer update
I have this error :
Problem 1
- The requested package ../symfony3-4 could not be found in any version, there
may be a typo in the package name.
Potential causes:
A typo in the package name
The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Do you have any suggestion to do it ?
use "symfony/symfony": "^3.0" in your require statement

Composer install wp-plugin to vendor dir

I'm using Roots/Bedrock for my WordPress structure and I want to use WebDevStudios/CMB2 as a library and not as a plugin.
The Roots/Bedrock composer.json specifies that dependencies of type:wordpress-plugin be installed in app/plugins. The WebDevStudios/CMB2 composer.json declares that it is a wordpress-plugin type, so it gets installed into app/plugins which is not where I want it.
How can I get this dependency to be installed into vendor and not app/plugins?
I have a suspicion I might have to fork CMB2 and change it's type from wordpress-plugin to library, but I'm hoping there is a cleaner solution.
I'm not using Roots/Bedrock but I had a similar problem when adding CMB2 as a dependency to a plugin (rather than loading it as a separate plugin). It was installing the plugin in wp-content/plugins instead of vendor. The following worked for me.
{
"require": {
"webdevstudios/cmb2": "^2.2",
},
"autoload" : {
"files": [
"vendor/webdevstudios/cmb2/init.php"
]
},
"extra": {
"installer-paths": {
"vendor/webdevstudios/cmb2": ["webdevstudios/cmb2"]
}
}
}
The key was the installer-paths entry that tells Composer where we want to install webdevstudios/cmb2.
I wrote a blog post about this at https://salferrarello.com/cmb2-composer-dependency/

unable to install phpunit with composer

basically i have this composer.json file:
{
"name": "phpunit/phpunit",
"require": {
"phpunit/phpunit": "3.8.*#dev"
},
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian#phpunit.de"
}
]
}
and when I go to run "composer install" i get the following error:
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for phpunit/phpunit 3.8.*#dev -> satisfiable by phpunit/phpunit[3.8.x-dev].
- phpunit/phpunit 3.8.x-dev requires phpunit/php-code-coverage 1.3.*#dev -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I have no clue as to what that means? Thanks
Before actually answering your question:
You have called your project phpunit/phpunit and you have a require on phpunit/phpunit. That is a circular dependency. You should call your project something else.
Also, I doubt that you are "Sebastian Bergmann" so you should change the name of the author and email address in your composer file.
Ok, for you actual question, Composer by default won't install dev packages. You need to explicitly tell it to install dev packages by putting
"minimum-stability": "dev"
in your root composer.json file for your project, or change the require for PHPUnit to not use the dev package e.g.
"require": {
"phpunit/phpunit": "3.8.*"
},
Unless you are actively debugging an issue in another package, it's unlikely that you actually want to use a dev version of that package. You almost always want an actual tagged version.

install AdmingeneratorGeneratorBundle

I am trying to install AdmingeneratorGeneratorBundle in the last version of symfony but I have had several problem
first I tried to use composer but I obtain this error
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package cedriclombardot/admingenerator-generator-bundle could not be found in any version, there may be a typo in the package name.
Problem 2
- The requested package knplabs/knp-menu-bundle master could not be found.
Finally I used git to install all vendor
The installation of this vendor is to extensive, so before to Install TwigGenerator a have to execute
php app/console admin:setup
but I obtain this error
PHP Fatal error: Call to undefined method Composer\Autoload\ClassLoader::registerNamespaces() in
the line 14 in autoLoad file contain this..
$loader->registerNamespaces(array(
'Admingenerator' => array(__DIR__.'/../src', __DIR__.'/../vendor/bundles'),
'Sensio\Bundle' => __DIR__.'/../vendor/bundles',
'Knp\Bundle' => __DIR__.'/../vendor/bundles',
'Knp\Menu' => __DIR__.'/../vendor/KnpMenu/src',
));
any idea!!
I had similar problem, but instead of manually installing with git, I changed minimum-stability flag to dev in composer.json:
{
"minimum-stability": "dev",
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
And added these deps:
"require": {
...
"knplabs/knp-menu-bundle": "dev-master",
"cedriclombardot/admingenerator-generator-bundle": "dev-master"

Contributing to open source bundles from vendor directory?

Ideal Situation
Often while working on a Symfony2 project I will spot something I want to change in one of my dependencies. If I could find a way to simply change it in vendor and then easily push the changes as a pull request then I would probably contribute more often (rather than overriding the part with a local child bundle).
The Problem
I can't change a vendor directory without composer freaking out on the next update. If I submit a pull request then it may take quite some time before I can actually use the code in vendors, which is actually a deterrent from contributing my new functionality.
How I do it now
The way I typically contribute to a bundle is to make a fork, put the fork in a barebones symfony standard-edition app, make the change and then submit a pull request.
Put fork in composer.json?
The only solution I can think of, is removing the packagist dependency of the bundle I am editing, and then including my fork with composer (as a package) from github. That way I get my code immediately and can still contribute.
Is this the only solution? How do you do it?
Any tips/advice for contributing to a bundle while working on a different project at the same time would be appreciated!
Nah... this is broken.
I've tried the official way to include a fork, here's an example (original:kitano, fork: jstoeffler) of the composer.json :
(For those who are in a hurry: THIS DOESNT WORK)
"repositories": [
//...
{
"type": "vcs",
"url": "https://github.com/jstoeffler/KitanoConnectionBundle",
},
//...
],
It keeps using the original bundle. Don't know what the problem is, and I don't get how everything works, but here's how I successfully add a fork to a project.
"repositories": [
//...
{
"type": "package",
"package": {
"name": "kitano/connection-bundle",
"version": "dev-master",
"source": {
"url": "https://github.com/jstoeffler/KitanoConnectionBundle.git",
"type": "git",
"reference": "master"
},
"autoload": {
"classmap": [""]
}
}
},
//...
],
[UPDATE: Answer Not Valid Anymore]
As pointed out in one of the comments, this answer is a couple years old and not correct anymore. See answers below for the correct way to proceed.
[Original answer below]
This is the approach recommended by Jordi Boggiano (#Seldaek), creator of composer.
See from his talk at Symfony Live San Francisco earlier this year (at the 2 minutes mark):
http://www.youtube.com/watch?list=PLo7mBDsRHu11ChvScWUE7MN1Qo5QVHQEz&feature=player_detailpage&v=P3NwF8RV1lY#t=120s
As of 2017 the proper way to do it is:
Add your GitHub branch link to the repositories
"repositories": [
{
"type": "vcs",
"url": "https://github.com/crimson-med/yii2-link-preview"
}
],
Add the source to the require of your composer.json
"require": {
"yii2mod/yii2-link-preview": "dev-master"
},
FYI, I just tried the very first option:
"repositories": [{
"type": "vcs",
"url": "https://github.com/thujohn/twitter"
}],
"require": {
"laravel/framework": "4.2.*",
"thujohn/twitter": "dev-master",
"anahkiasen/flickering": "^0.1.2",
"fairholm/elasticquent": "dev-master",
"facebook/php-sdk-v4" : "~5.0"
},
An it worked fine.
vagrant#dev:/var/www$ sudo php composer.phar update
Loading composer repositories with package information Updating dependencies (including require-dev)
- Removing thujohn/twitter (2.0.4)
- Installing thujohn/twitter (dev-master 7a92118)
Downloading: 100%
Writing lock file
Generating autoload files
> php artisan clear-compiled
> php artisan optimize
Generating optimized class loader
I just needed to specify the "master" branch name as "dev-master".

Resources