I'm building a laravel package, but it won't autoload.
This is the autoload section of my package:
"autoload": {
"classmap": [
"src"
],
"psr-4": {
"Doitonlinemedia\\Translatableroutes\\": "src/"
}
}
Classes are namespaced like Doitonlinemedia\Translatableroutes
Folder structure is like:
- vendor
- - doitonlinemedia
- - - translatableroutes
- - - - composer.json
- - - - src
- - - - - class1.php
I've added the ServiceProvider in app.php like:
Doitonlinemedia\Translatableroutes\TranslatableRoutesServiceProvider::class
But it keeps saying Class 'Doitonlinemedia\Translatableroutes\TranslatableRoutesServiceProvider' not found
Run composer dump-autoload
on every change.
What am I doing wrong?
EDIT
For development I added: "Doitonlinemedia\\Translatableroutes\\": "packages/doitonlinemedia/translatableroutes/src"
to the main composer.json file. But when I require this composer package into a new project I'm getting the above problems.
To try out this package: https://github.com/doitonlinemedia/TranslatableRoutes and follow the instructions