I am developing a package based on the an api for admin panel I did using laravel and Service Archicture. I hace included Services folder in the src folder. I now want to change it into a package however I am getting error.
{
"message": "Target class [App\\Services\\UserService] does not exist.",
"exception": "Illuminate\\Contracts\\Container\\BindingResolutionException",
"file": "D:\\microvision\\projects\\_test\\packages\\test-project-1\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 946,
I am developing a package based on the an api for admin panel I did using laravel and Service Archicture. I hace included Services folder in the src folder. I now want to change it into a package however I am getting error.
{
"message": "Target class [App\\Services\\UserService] does not exist.",
"exception": "Illuminate\\Contracts\\Container\\BindingResolutionException",
"file": "D:\\microvision\\projects\\_test\\packages\\test-project-1\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php",
"line": 946,
You're likely referencing the wrong namespace. In your package, update your service bindings from App\Services\UserService
to the correct package namespace (e.g., Vendor\Package\Services\UserService
), adjust your composer.json autoload settings accordingly, and run composer dump-autoload
.
App
as your root namespace if you are developing a package since that will conflict with the root namespaces of most people that would want to use the package – apokryfos Commented Feb 3 at 23:28