public function register()
    {
        // Register our binding resolver in the service container
        $this->binder = new BindingResolver([$this->app, 'make']);
        $this->app->instance('bindingResolver', $this->binder);

        // Create a new FastRoute dispatcher (our extended one)
        // with no routes data at the moment because routes file is not loaded yet
        $this->dispatcher = new FastRouteDispatcher(null);

        // Set binding resolver
        $this->dispatcher->setBindingResolver($this->binder);

        // Set routes resolver (will be called when request is dispatched and the routes file is loaded)
        $this->dispatcher->setRoutesResolver($this->getRoutesResolver());

        // Set our dispatcher to be used by the application instead of the default one
        $this->app->setDispatcher($this->dispatcher);

        // Save the dispatcher in the container in case someone needs it later (you're welcome)
        $this->app->instance('dispatcher', $this->dispatcher);
    }
public function register()
    {
        // Register our binding resolver in the service container
        $this->binder = new BindingResolver([$this->app, 'make']);
        $this->app->instance('bindingResolver', $this->binder);

        // Create a new FastRoute dispatcher (our extended one)
        // with no routes data at the moment because routes file is not loaded yet
        $this->dispatcher = new FastRouteDispatcher(null);

        // Set binding resolver
        $this->dispatcher->setBindingResolver($this->binder);

        // Set routes resolver (will be called when request is dispatched and the routes file is loaded)
        $this->dispatcher->setRoutesResolver($this->getRoutesResolver());

        // Set our dispatcher to be used by the application instead of the default one
        $this->app->setDispatcher($this->dispatcher);

        // Save the dispatcher in the container in case someone needs it later (you're welcome)
        $this->app->instance('dispatcher', $this->dispatcher);
    }
public function register ( ) { // Register our binding resolver in the service container $ this -> binder = new BindingResolver ( [ $ this -> app , 'make' ] ) ; $ this -> app -> instance ( 'bindingResolver' , $ this -> binder ) ; // Create a new FastRoute dispatcher (our extended one) // with no routes data at the moment because routes file is not loaded yet $ this -> dispatcher = new FastRouteDispatcher ( null ) ; // Set binding resolver $ this -> dispatcher -> setBindingResolver ( $ this -> binder ) ; // Set routes resolver (will be called when request is dispatched and the routes file is loaded) $ this -> dispatcher -> setRoutesResolver ( $ this -> getRoutesResolver ( ) ) ; // Set our dispatcher to be used by the application instead of the default one $ this -> app -> setDispatcher ( $ this -> dispatcher ) ; // Save the dispatcher in the container in case someone needs it later (you're welcome) $ this -> app -> instance ( 'dispatcher' , $ this -> dispatcher ) ; }
Register the service by registering our custom dispatcher.
Register the service by registering our custom dispatcher .