Composer error when I want to install fosuserbundle - symfony

When I use this command in cmd
php composer.phar update friendsofsymfony/user-bundle
I get this message
Please provide a version constraint for the
friendsofsymfony/user-bundle requirement: 2.0.*#dev composer.json has
been updated Loading composer repositories with package information
Updating dependencies (including require-dev) Your requirements could
not be resolved to an installable set of packages.
Problem 1
- The requested package friendsofsymfony/user-bundle 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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion
for more details.
Read http://getcomposer.org/doc/articles/troubleshooting.md for
further common problems.
Installation failed, reverting composer.json to its original content.
I've already added "minimum-stability": "dev", in my composer.json
It's the first time that I head this problem I installed fosuserbundle manytimes and it worked before.

I just Advice you just use this to configure all the sonata admin + fos user bundle without any dependencies or version conflicts
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/admin-bundle": "~2.3#dev",
"sonata-project/doctrine-orm-admin-bundle": "~2.3#dev",
"sonata-project/core-bundle": "~2.2#dev",
"sonata-project/user-bundle": "2.2.x-dev",
"friendsofsymfony/user-bundle": "~1.3#dev",
"sonata-project/easy-extends-bundle": "~2.1#dev",
"sonata-project/intl-bundle": "2.2.x-dev",
"knplabs/knp-paginator-bundle": "dev-master",
"knplabs/knp-time-bundle": "dev-master",
"knplabs/knp-menu-bundle": "1.1.*",
"jms/serializer-bundle": "0.13.*#dev"
},

So I fixed, it should be:
"friendsofsymfony/user-bundle": "~2.0#dev"
not
"friendsofsymfony/user-bundle ": "~2.0#dev"

Related

Symfony 2.8 How to include GuzzleHttp as Bundle

Guzzle is outdated and so I installed instead via composer the recommended replacement
"guzzlehttp/guzzle": "^6.3",
I checked in the vendor directory and there is my guzzlehttp lib:
guzzlehttp, although I also still see the old guzzle even after deleting the whole vendor directory and doing composer update again.
However in my Appkernel.php I want to include now guzzlehttp instead of the old eightpoint guzzle as a Bundle and wonder how to do that.
The old syntax was like this:
new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),
I tried with
new GuzzleHttp\GuzzleBundle(),
But it isn't found. Do I miss another step? If yes which one?
Edit:
original composer.json where I want to replace guzzle with the guzzleHttp since this guzzle package seems to be abandoned:
"require": {
"php": ">=7.0",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"eightpoints/guzzle-bundle": "4.5.*",
"symfony/finder": "^2.8",
"jms/serializer-bundle": "^1.1",
"jms/di-extra-bundle": "~1.3",
"jms/aop-bundle": "~1.1",
"jms/cg": "~1.1",
"psr/cache": "~1.0",
"predis/predis": "1.*",
"snc/redis-bundle": "2.*",
"cache/predis-adapter": "*",
"willdurand/hateoas-bundle": "^1.0",
"hautelook/templated-uri-bundle": "^2.0",
"willdurand/rest-extra-bundle": "^1.0",
"friendsofsymfony/rest-bundle": "^1.7",
"friendsofsymfony/http-cache-bundle": "^1.0",
"avtonom/semaphore-bundle": "dev-master",
"symfony/stopwatch": "*"
},
"require-dev": {
"sensio/generator-bundle": "*",
"phpunit/phpunit": "*",
"phpunit/php-invoker": "*",
"squizlabs/php_codesniffer": "*",
"friendsofphp/php-cs-fixer": "*",
"diablomedia/phpunit-pretty-printer": "*"
},
....
The Guzzle lib does not provide any Symfony integration. Seems like you are using an old version of EightPointsGuzzleBundle.
Instead of requiring guzzlehttp/guzzle which is just a lib, do composer require eightpoints/guzzle-bundle and then in your AppKernel add
new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle()
Maybe you should just update your bundle to a newer version.

Ignore dependencies with composer

I need to install a new dependency in one old symfony 2.3 application. But seems that the previous installed packages are to old that I get the next error: "Your requirements could not be resolved to an installable set of packages."
This are my current dependencies:
"php": ">=5.3.
"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/data-fixtures": "dev-master",
"knplabs/knp-menu":"dev-master",
"knplabs/knp-menu-bundle":"dev-master",
"liuggio/excelbundle": ">=1.0.4",
"tecnick.com/tcpdf": "6.0.023"
I need to add: "phpoffice/phpword": "v0.13.*" that require zend framework's packages.
There is any way of install my new dependencie without affect the already installed packages?
If you run composer why-not "phpoffice/phpword", you may get additional clarity as to what the problem is, and start to work around it by updating some packages to newer versions that can work together.

Failed to Install Data-Fixtures with Doctrine and Symfony2

I added the docrtine-fixtures and the doctrine-fixtures-bundle to my dependencies in the composer.json, as follow:
{
"require": {
"php": ">=5.3.3",
"symfony/finder": "2.3.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/data-fixtures": "~1.1",
"doctrine/doctrine-fixtures-bundle": "~2.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0"
}
}
And then I did php-cli composer.phar update, which worked and displayed the right message on my terminal:
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Updating doctrine/data-fixtures (dev-master bd44f6b => v1.1.1)
Checking out bd44f6b6e40247b6530bc8abe802e4e4d914976a
Writing lock file
Generating autoload files
Bu when I go to the folder vendor/doctrine, I cannot find any data-fixtures repository. What is the issue? Why does composer not load it and why does it display success messages?
(PS: My solution was to add the doctrine-fixture repository manually but it doesn't solve the composer issue).
It could be a Composer caching issue. Try removing Composer's cache directory:
rm -rf ~/.composer/cache

Call to method setCurrentUri fails in Symfony/SonataUserBundle setup

I am trying to set up Symfony with the SonataUserBundle. User registration and login works fine. When I try to call up the /profile view, however I get the following error:
Attempted to call method "setCurrentUri" on class "Knp\Menu\MenuItem" in F:\<my project path>\vendor\sonata-project\user-bundle\Block\ProfileMenuBlockService.php line 91. Did you mean to call: "setCurrent"?
The last notice in the "event list" before the error is
INFO - [cms::renderBlock] block.id=53, block.type=sonata.user.block.menu
Has anyone encountered this error before and can provide information on how to resolve it?
TIA
Matt
What versions of KnpMenu and SonataBlockBundle are you using? Please check your composer.json to be sure.
The setCurrentUri method has been deprecated as of KnpMenu v. 2.0, and the composer.json of SonataBlockBundle does not require KnpMenu anywhere but in dev install. So, this leads to a possibility that you could have required a fresher version of knplabs/knp-menu-bundle that is not yet supported by Sonata bundle.
Try requiring knplabs/knp-menu-bundle in 1.1.x:
{
...
"require": {
"knplabs/knp-menu-bundle": "~1.1"
},
...
}
I encountered the same problem, but downgrade to Knpmenu version 1 is not possible for our project. Because of some code update the June 16th, it is now possible to use Sonata User Bundle and Knp Menu Version 2.
Please, have a look on my composer.json :
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/migrations": "dev-master",
"doctrine/doctrine-migrations-bundle": "dev-master",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~1.3",
"friendsofsymfony/message-bundle": "^1.2",
"sonata-project/admin-bundle": "^2.3",
"sonata-project/doctrine-orm-admin-bundle": "^2.3",
"sonata-project/easy-extends-bundle": "^2.1",
"sonata-project/user-bundle": "dev-master",
"sonata-project/datagrid-bundle": "dev-master",
"sonata-project/block-bundle": "~2.2,>=2.2.7,<2.3",
"sonata-project/exporter": "^1.4",
"sonata-project/intl-bundle": "^2.2",
"knplabs/knp-menu-bundle": "~2.0",
"knplabs/knp-menu": "~2.0"
},
As you can see, sonata-project/user-bundle is under dev-master version and I had to add sonata-project/datagrid-bundle in dev-master
Hope to help developpers who want want to preserve KnpMenu V2 !
I had same issue, This is my solution that you can preserve KnpMenu V2.
-You change setCurrentUri to setCurrent (because KNP changed code) in C:\path\vendor\sonata-project\user-bundle\Block\ProfileMenuBlockService.php
-You can have this problem, Method "currentAncestor" for object "Knp\Menu\MenuItem" does not exist in Sonata
And this works for me.

Upgrading Symfony2 and SonataAdminBundle (Mar 01, 2013) after last update

After last update SonataAdminBundle (Mar 01, 2013) I can not update components using composer
composer.json
...
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.1.*",
"twig/extensions": "1.0.*#dev",
"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.*",
"kriswallsmith/assetic": "1.1.*#dev",
...
"sonata-project/admin-bundle": "dev-master",
"sonata-project/intl-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/cache-bundle": "dev-master"
},
...
php composer.phar update symfony/symfony
Problem 1
- Installation request for sonata-project/admin-bundle dev-master -> satisfiable by sonata-project/admin-bundle dev-master.
- Can only install one of: sonata-project/admin-bundle dev-master, sonata-project/admin-bundle 2.1.x-dev.
- Installation request for sonata-project/admin-bundle == 2.1.9999999.9999999-dev -> satisfiable by sonata-project/admin-bundle 2.1.x-dev.
You have set the version of the sonata-project packages to dev-master. The master branch is in sync with the symfony's stable release. Since Symfony2.2 is released on 1 march, you need to update these versions to not require Symfony2.2, or update your project to symfony2.2 (shouldn't be that difficult).
Solution 1: Updating sonata-project versions
Change this:
"sonata-project/admin-bundle": "dev-master",
"sonata-project/intl-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/cache-bundle": "dev-master"
to
"sonata-project/admin-bundle": "2.1.x",
"sonata-project/intl-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "2.1.x",
"sonata-project/cache-bundle": "dev-master"
Solution 2: Updating Symfony2.1 to 2.2
Read the news article on how to update your project from Symfony2.1 to 2.2. Basically, this means updating the composer.json according to the changes on the main repo, running php composer.phar update and reading the UPGRADE-2.2.md file on what has changed.
Try:
"sonata-project/admin-bundle": "2.1.*",
"sonata-project/doctrine-orm-admin-bundle": "2.1.*#dev",
"sonata-project/intl-bundle": "2.1.*",
"sonata-project/cache-bundle": "2.1.*"
It's work for me.

Resources