Skip to content

Compatibility with RouteServiceProvider - respect the order of initialization #118

@josefryzi

Description

@josefryzi

Hi,
is it possible to respect order of initialization in app/providers.php?

My app providers order:

  • App\Providers\AnnotationsServiceProvider::class,
  • App\Providers\RouteServiceProvider::class,

The intro:

  • I am using RouteServiceProvider with some routes in web.php
  • I am using fallback route Route::get('/{any}', ...) to catch all undefined routes - lets call this route "fallback_route"
  • I created route via annotation + route is cached (with artisan route:scan) - lets call this route "route_a"

The problem:

  • when I want to visit "route_a" I am getting "fallback_route"
  • when I disable "fallback_route" then "route_a" is working
  • seems like anotation routes are inserted after RouterServiceProvider even I initialized AnnotationsServiceProvider before RouterServiceProvider

Solution:
A) Respect order of providers in app/provider.php
B) Somehow trigger annotations boot method before RouterServiceProvider class
C) please suggest solution

Could you pleaase help me?
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions