iamhssingh iamhssingh - 5 months ago 72
PHP Question

Can't install Dingo with Laravel

I just removed my installed laravel folder in which I installed Dingo and JWT easily. Laravel version was 5.2.x.

Now, whenever I try to reinstall Dingo API it gives me error. Here is the list of commands I used:

Steps to Install




  1. Install Laravel:
    composer create-project laravel/laravel citycare 5.2.*
    . (I have also tried with 5.1.*)

  2. Install Dingo:
    composer require dingo/api:1.0.x@dev
    .



Here is the error



You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
./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
- Conclusion: don't install dingo/api 1.0.x-dev
- Conclusion: don't install dingo/api v1.0.0-beta3
- Conclusion: remove laravel/framework v5.2.38
- Installation request for phpdocumentor/reflection-docblock == 3.1.0.0 -> satisfiable by phpdocumentor/reflection-docblock[3.1.0].
- Conclusion: don't install laravel/framework v5.2.38
- dingo/api v1.0.0-beta1 requires illuminate/support 5.1.* -> satisfiable by illuminate/support[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.6, v5.1.8].
- dingo/api v1.0.0-beta2 requires illuminate/support 5.1.* -> satisfiable by illuminate/support[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.6, v5.1.8].
- don't install illuminate/support v5.1.1|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.13|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.16|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.2|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.20|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.22|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.25|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.28|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.30|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.31|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.6|don't install laravel/framework v5.2.38
- don't install illuminate/support v5.1.8|don't install laravel/framework v5.2.38
- Installation request for laravel/framework == 5.2.38.0 -> satisfiable by laravel/framework[v5.2.38].
- Installation request for dingo/api 1.0.x@dev -> satisfiable by dingo/api[1.0.x-dev, v1.0.0-beta1, v1.0.0-beta2, v1.0.0-beta3].


Installation failed, reverting ./composer.json to its original content.

Answer

Andrey B, I tried that but that doesn't worked for me. Apparently, I decided to go ahead and try some more things in order to make it work. And here is the solution that I found:

I added "phpdocumentor/reflection": "3.x@dev" under "require": { } in composer.json and ran a composer update.

After this, composer require ran successfully.

I am still unable to find what caused this problem. I guess, last time I installed, the composer.json already had phpdocumentor inside it.

Have a look at my new composer.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "phpdocumentor/reflection": "3.x@dev",
        "dingo/api": "1.0.x@dev",
        "zizaco/entrust": "5.2.x-dev"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
        "laracasts/generators": "^1.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

And also note I am using Laravel 5.1.x.