geocoder-php/GeocoderLaravel

Error with Laravel 5.4

sameer1202 opened this issue · 5 comments

General Information

Laravel Version: 5.4
PHP Version: 7.0.15
Operating System and Version: ubuntu 16.04

Issue Description

[I am upgrading from laravel 5.3 to 5.4 ]
In composer.json I have added "toin0u/geocoder-laravel": "^1.0", .I have also removed the config/geocoder.php configuration file .
There is no Geocoder alias in the aliases section of the config/app.php.

have added Geocoder\Laravel\Providers\GeocoderService::class, in config/app.php . but still getting the error when I do ** composer update ** or** composer install **.

Nothing to install or update
Package egeloen/http-adapter is abandoned, you should avoid using it. Use php-http/httplug instead.

Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize

                                                             
  [Symfony\Component\Debug\Exception\FatalThrowableError]    
  Class 'Toin0u\Geocoder\GeocoderServiceProvider' not found  
                                                             

my composer.json file looks like

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "minimum-stability": "dev",
    "prefer-stable": true,

    "require": {
        "php": ">=5.6.4",
        "toin0u/geocoder-laravel": "^1.0",
        //"toin0u/geocoder-laravel": "@stable",
        "laravel/framework": "5.4.*",
        "illuminate/support": "5.4.x",
        "illuminate/console": "5.4.x",
        "symfony/process": "~3.2",
        "barryvdh/laravel-async-queue": "0.6.x",
        "laravelcollective/html": "5.4.x-dev"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7",
        "symfony/css-selector": "3.1.*",
        "symfony/dom-crawler": "3.1.*",
        "barryvdh/laravel-debugbar": "^2.1"
    },
    "autoload": {
        "classmap": [
            "database",
            "app/Models",
            "database/migrations",
            "database/seeds",
            "app/libraries"
        ],
    "psr-4": {
            "App\\": "app/"
        }
    },

     "extra": {
        "branch-alias": {
            "dev-master": "0.6-dev"
        }
    },

    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || 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 ide-helper:generate", 
            "php artisan ide-helper:meta",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

what could be the actual problem ?
Thank-you.

Somewhere in your code you are trying to use a class Toin0u\Geocoder\GeocoderServiceProvider which doesn't exists. Check UPGRADING section in README. (step 4 I think)

Thanks for jumping in @zedentox ! :) @sameer1202 Please let me know if that solved the issue.

Thanks for your reply sir @zedentox @mikebronner .
yeah there was a class Toin0u\Geocoder\GeocoderServiceProvider in my config/app.php but now I have removed that line from my code. It is still giving error .
I think the actual problem is with Geocoder\Laravel\Providers\GeocoderService::class, when I add this line in the app.php the error comes .
I added "toin0u/geocoder-laravel": "^1.0" in composer.json
and do the composer update everything is working fine , composer install and update is working fine but ,
when I add Geocoder\Laravel\Providers\GeocoderService::class in app.php It gives error .

What could be the problem ?
Thanks for your help !

Error fixed by removing "toin0u/geocoder-laravel": "^1.0" and Geocoder\Laravel\Providers\GeocoderService::class in app.php from the code and updating composer and reinstalling the geocoder , This fixed the above problem .

Bdw Thanks for your help! Issue can be closed now ,but as I have seen in previous issues many people have complained the same error that when they add Geocoder\Laravel\Providers\GeocoderService::class in app.php it causes error . what could be the possible reason for that .
Thank-you

Having the wrong version of the package installed is the most common, I would say. Or not following the upgrade process as intended. You're right that it does seem to cause some confusion, but I hope that will become minimal as more people upgrade.

Glad to see you got everything working again! :)