I know the title topic sounds similar to other questions, but I've searched many topics on stackoverflow and none resolve my issue.
I am currently developing a package under Laravel ^8.12, below the content of the function that register my routes:
protected function registerRoutes(): void { Route::prefix('workflowmakr') ->namespace('AlvariumDigital\WorkflowMakr\Http\Controllers') ->as('workflowmakr.') ->middleware(config('workflowmakr.routes_middleware')) ->group(__DIR__ . '/../routes/api.php'); } And below is the content of the routes/api.php file:
<?php use Illuminate\Support\Facades\Route; Route::resource('actions', 'ActionController')->except(['created', 'edit']); Route::resource('scenarios', 'ScenarioController')->except(['created', 'edit']); Route::resource('statuses', 'StatusController')->except(['created', 'edit']); Route::resource('transitions', 'TransitionController')->except(['created', 'edit']); For a better view of the project architecture, below is a screenshot of the packages folder containing the package under development:
And finally, below is the composer.json declaring my package:
... "extra": { "laravel": { "providers": [ "AlvariumDigital\\WorkflowMakr\\WorkflowMakrServiceProvider" ] } }, "autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/", "AlvariumDigital\\WorkflowMakr\\": "packages/AlvariumDigital/WorkflowMakr/src/" } }, ... When I execute the command php artisan route:list to view all my routes I got this error :
$> php artisan route:list Illuminate\Contracts\Container\BindingResolutionException Target class [AlvariumDigital\WorkflowMakr\Http\Controllers\ActionController] does not exist. at D:\Films\R_D\Laravel packages\workflow-makr\vendor\laravel\framework\src\Illuminate\Container\Container.php:832 828▕ 829▕ try { 830▕ $reflector = new ReflectionClass($concrete); 831▕ } catch (ReflectionException $e) { ➜ 832▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e); 833▕ } 834▕ 835▕ // If the type is not instantiable, the developer is attempting to resolve 836▕ // an abstract type such as an Interface or Abstract Class and there is 1 [internal]:0 Illuminate\Foundation\Console\RouteListCommand::Illuminate\Foundation\Console\{closure}(Object(Illuminate\Routing\Route)) 2 D:\Films\R_D\Laravel packages\workflow-makr\vendor\laravel\framework\src\Illuminate\Container\Container.php:830 ReflectionException::("Class AlvariumDigital\WorkflowMakr\Http\Controllers\ActionController does not exist") EDIT
Below is the content of the ActionController file:
<?php namespace AlvariumDigital\WorkflowMakr\Http\Controllers; use AlvariumDigital\Models\Action; use AlvariumDigital\WorkflowMakr\Helpers\Constants; use Illuminate\Routing\Controller; use Illuminate\Http\Request; use Illuminate\Support\Facades\Validator; class ActionController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\JsonResponse */ public function index() { $query = Action::query(); if (config('workflowmakr.pagination_size') == -1) { return response()->json($query->get(), 200); } return response()->json($query->paginate(config('workflowmakr.pagination_size')), 200); } // ... } EDIT 2
The content of the package composer.json file:
{ "name": "AlvariumDigital/WorkflowMakr", "description": "Generalize the management of your workflows", "type": "library", "license": "MIT", "authors": [ { "name": "Alvarium Digital", "email": "[email protected]", "homepage": "http://www.alvariumdigital.com", "role": "Corporate" }, { "name": "EL OUFIR Hatim", "email": "[email protected]", "homepage": "https://www.linkedin.com/in/eloufirhatim/", "role": "Developer" } ], "support": { "email": "[email protected]" }, "minimum-stability": "dev", "require": {} } Did I do something wrong or incomplete? You can ask for more details if needed.
Thanks

Route::resourcewithout 'create' and 'edit' is the same asRoute::apiResourcecomposer dump-autoloadafter adding the namespace (psr4) entry to composer.json?"repositories": [ {"type": "path", "url":"packages/AlvariumDigital/WorkflowMakr"}]in the composer.json of your app then runcomposer require AlvariumDigital/WorkflowMakrto require your package in the app. However as @lagbox has suggested your files should be insrcif you are pointing the namespace to the src directory