Laravel build a route from a model
Laravel coupling

What a shame that you decided to tie this to laravel. You can decouple the entire library from laravel framework and only provide a bundle for laravel.

routeFromModel accepts Model, but it can actually work for any object.

$route = $router-&gt;getRoutes()-&gt;getByName($routeName);
if (!$route) {
  throw new RouteNotFoundException("Route $routeName not found");
}
$params = $route-&gt;parameterNames();


This means you really don't need the router, you just need something that gives you an "array of prameter names" based on a "name".

return rtrim($urlGen-&gt;route($routeName, $data), '?');


Returning just the data here would make it more flexible.

IoC

You are pulling the RouteBuilder from DI container, why not have the container inject those deps. The way it is now, it could just be a static class with only static methods...