I’m trying to install a custom Laravel package locally by placing it inside the packages/ directory of my Laravel project.
Here’s what I’ve done so far:
I added the package to packages/Webkul/DeliveryTimeSlot
Updated my main composer.json file with the PSR-4 autoload configuration:
"autoload": {
"psr-4": {
"App\": "app/",
"Webkul\DeliveryTimeSlot\": "packages/Webkul/DeliveryTimeSlot/src/"
} }
After running:
composer dump-autoload
I receive the following warning:
Class CreateDeliveryTimeSlotsTable located in ./packages/Webkul/DeliveryTimeSlot/src/Database/Migrations/2020_01_27_001254_create_delivery_time_slots_table.php does not comply with psr-4 autoloading standard (rule: WebkulDeliveryTimeSlot => ./packages/Webkul/DeliveryTimeSlot/src). Skipping.
Class CreateDeliveryTimeSlotsOrdersTable located in ./packages/Webkul/DeliveryTimeSlot/src/Database/Migrations/2020_01_30_001255_create_delivery_time_slots_orders_table.php does not comply with psr-4 autoloading standard (rule: WebkulDeliveryTimeSlot => ./packages/Webkul/DeliveryTimeSlot/src). Skipping.
Here’s the relevant directory structure:
packages/
└── Webkul/
└── DeliveryTimeSlot/
└── src/
└── Database/
└── Migrations/
├── 2020_01_27_001254_create_delivery_time_slots_table.php
└── 2020_01_30_001255_create_delivery_time_slots_orders_table.php
It looks like the issue is with PSR-4 autoloading for the migration classes. Do I need to define namespaces in those migration files? If so, what should the correct namespace be?
Thanks in advance for your help!