Skip to content

Doesn't work on PHP8+ for standalone (non-laravel) apps #614

Description

@aleemb

(new issue since #611 is stale)

Former is broken on PHP8+ standalone installs and throws the error:

Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Routing\RouteCollectionInterface] is not instantiable while building [Illuminate\Routing\UrlGenerator]

I found the quick fix is as follows, however, I am not familiar with the framework to do this proper. The fix that works for me is inside FormerServicesProvider.php I add the following in bindCoreClasses under the Core Classes comment:

	$app->bindIf(
		\Illuminate\Routing\RouteCollectionInterface::class,
		\Illuminate\Routing\RouteCollection::class
	);

Trying $app->bindIf('routing', \Illuminate\Routing\RouteCollection::class); didn't work, however.

Hope this can be fixed in the repo so Former can once again be used outside of Laravel (when using PHP8+). This is the only thing preventing that use-case right now for anyone using it outside of Laravel, myself included.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions