dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.32k stars 1.25k forks source link

Not support for Laravel 5.4 with errors in Route::getUri() #1317

Open libern opened 7 years ago

libern commented 7 years ago
[2017-01-26 11:22:36] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Routing\Route::getUri() in /home/vagrant/Code/someline-starter-master/vendor/dingo/api/src/Routing/Adapter/Laravel.php:98
Stack trace:
#0 /home/vagrant/Code/someline-starter-master/vendor/dingo/api/src/Routing/Route.php(158): Dingo\Api\Routing\Adapter\Laravel->getRouteProperties(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/vagrant/Code/someline-starter-master/vendor/dingo/api/src/Routing/Route.php(148): Dingo\Api\Routing\Route->setupRouteProperties(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#2 /home/vagrant/Code/someline-starter-master/vendor/dingo/api/src/Routing/Router.php(696): Dingo\Api\Routing\Route->__construct(Object(Dingo\Api\Routing\Adapter\Laravel), Object(Illuminate\Foundation\Application), Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#3 /home/vagrant/Code/someline-starter-master/vendor/dingo/api/src/Routing/Router.php(758): Dingo\Api\Routing\Router->createRoute(Object(Illuminate\Routing\Route))
#4 /home/vagrant/Code/someline-starter-master/vendor/dingo/api/src/Console/Command/Routes.php(55): Dingo\Api\Routing\Router->getRoutes()
#5 [internal function]: Dingo\Api\Console\Command\Routes->__construct(Object(Dingo\Api\Routing\Router))
#6 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Container/Container.php(714): ReflectionClass->newInstanceArgs(Array)
#7 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('Dingo\\Api\\Conso...')
#8 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): Illuminate\Container\Container->make('Dingo\\Api\\Conso...')
#9 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Console/Application.php(192): Illuminate\Foundation\Application->make('Dingo\\Api\\Conso...')
#10 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Console/Application.php(206): Illuminate\Console\Application->resolve('Dingo\\Api\\Conso...')
#11 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php(232): Illuminate\Console\Application->resolveCommands(Array)
#12 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Console/Application.php(111): Illuminate\Support\ServiceProvider->Illuminate\Support\{closure}(Object(Illuminate\Console\Application))
#13 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Console/Application.php(58): Illuminate\Console\Application->bootstrap()
#14 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(287): Illuminate\Console\Application->__construct(Object(Illuminate\Foundation\Application), Object(Illuminate\Events\Dispatcher), '5.4.3')
#15 /home/vagrant/Code/someline-starter-master/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(123): Illuminate\Foundation\Console\Kernel->getArtisan()
#16 /home/vagrant/Code/someline-starter-master/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 {main}  
libern commented 7 years ago

In issues addressed this, #1314. If I need this package urgently, will you release it first or how to quick fix it?

libern commented 7 years ago

To install the latest dev-master branch, also don't work!

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: remove laravel/framework v5.4.3
    - Conclusion: don't install laravel/framework v5.4.3
    - Conclusion: don't install laravel/framework v5.4.2
    - Conclusion: don't install laravel/framework v5.4.1
    - Conclusion: don't install laravel/framework v5.4.0
    - Installation request for dingo/api dev-master -> satisfiable by dingo/api[dev-master].
rhwilr commented 7 years ago

This is because in composer.json the dev-master is aliased to 1.0-dev. Until a new version is tagged you could use my fork:

    "require": {
        "dingo/api": "dev-master",
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/rhwilrForks/api"
        },
        {
            "type": "vcs",
            "url": "https://github.com/rhwilrForks/blueprint"
        }
    ],
bionicmaster commented 7 years ago

Api is still pointing to old blueprint that doesn't work with 5.4 yet

Broutard commented 7 years ago

+1 Please tag a new version for Laravel 5.4

lartisan commented 7 years ago

+1

tylerjbainbridge commented 7 years ago

+1

imagine10255 commented 7 years ago

+1

enniel commented 7 years ago

+1

bakerstreetsystems commented 7 years ago

I know it's really ugly, but if you're being held up by this issue and you desperately need to get around it, you could do the following (until a patch is officially released):

That's how I got things up and running for the time being.

stojankukrika commented 7 years ago

it doesn't work

andrewvergel commented 7 years ago

I made a simple line to script section into the composer.json to download the last version for this file Routing/Adapter/Laravel.php

  1. Only add this line in post-create-project-cmd section

wget -q https://raw.githubusercontent.com/dingo/api/master/src/Routing/Adapter/Laravel.php -O vendor/dingo/api/src/Routing/Adapter/Laravel.php

like this

"post-create-project-cmd": [
            "wget -q https://raw.githubusercontent.com/dingo/api/master/src/Routing/Adapter/Laravel.php -O vendor/dingo/api/src/Routing/Adapter/Laravel.php",
            "php artisan key:generate",
            "php artisan jwt:generate"
        ],
  1. Run composer update
Broutard commented 7 years ago

You could reference the last master commit : "dingo/api": "dev-master#a852013"

asamaru7 commented 7 years ago

+1

libern commented 7 years ago

@Broutard not working sir!

ThinkMe commented 7 years ago

@libern success ???

SebastianBerc commented 7 years ago

+1

ThinkMe commented 7 years ago

public function getRouteProperties($route, Request $request) { return [$route->uri(), $route->methods(), $route->getAction()]; }

ThinkMe commented 7 years ago

@YannGrosjean what? 成功了吗?

JackDPro commented 7 years ago

+1

gitstashgithub commented 7 years ago

+1

renege commented 7 years ago

+1

Elema82 commented 7 years ago

I am working on the development of an api and it is working with larevel "5.4.*" and dingo "dev-master # a852013" tested with "php artisan api:routes" and tests on codeception, work ok @Broutard

alex996 commented 7 years ago

What about Laravel 5.5?