What is the issue exactly, the ->group(__DIR__ . '/../routes/web.php')?
Can you show the package's composer.json?
I keep running into problems in auto load. I have created my own package structure which look like this
└───ecommerce
└───src
│ composer.json
│ package.json
│ vite.config.js
│
├───app
│ ├───Http
│ │ ├───Controllers
│ │ │ EcommerceController.php
│ │ │
│ │ └───Models
│ │ Product.php
│ │
│ └───Models
├───databases
│ ├───migrations
│ │ 2025_08_29_123456_create_products_table.php
│ │
│ └───seeders
├───Providers
│ EcommerceServiceProvider.php
│
├───resources
│ └───js
│ │ ecommerce.jsx
│ │
│ ├───components
│ │ ProductCard.jsx
│ │
│ └───Pages
│ └───Products
│ Index.tsx
│
└───routes
web.php
and I have three files, routes, controller, and Service Provider which seems to be the problem.
Service Provider
<?php
namespace Ecommerce\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Route;
class EcommerceServiceProvider extends ServiceProvider
{
// ...
protected function registerRoutes()
{
Route::middleware('web')
->namespace('Ecommerce\App\Http\Controllers')
->group(__DIR__ . '/../routes/web.php');
}
}
Routes
<?php
use Illuminate\Support\Facades\Route;
use Ecommerce\App\Http\Controllers\EcommerceController;
Route::get('/ecommerce', [EcommerceController::class, 'index']);
Controller
<?php
namespace Ecommerce\App\Http\Controllers;
use App\Http\Controllers\Controller;
use Inertia\Inertia;
class EcommerceController extends Controller
{
public function index()
{
return Inertia::render('Ecommerce/Index');
}
}
I don't know why this is a problem if I hard code the file address it gets around the problem but I don't want to do it this way. It even has AI stumped.
Are you calling that registerRoutes() method somewhere? I don't see a boot() method in your provider.
I've always registered package routes the way that's shown in the docs:
Please or to participate in this conversation.