I have a Laravel package located in the packages/ directory. I want to dynamically load and register it without manually running composer dump-autoload or any CLI commands.
Requirements: The package should be discovered and available after visiting a specific route (e.g., /discover-package). It should be persistently available, even after clearing cache, sessions, or restarting the server. The solution should be fully programmatic, meaning any new package added should be detected and loaded dynamically. The package’s service provider and classes must be autoloaded correctly within Laravel’s application lifecycle. Has anyone implemented a similar solution? What is the best way to achieve this?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community