Yash Sanandiya
Yash Sanandiya

Reputation: 1

I want to Dynamically Load Laravel Package Without Running Composer Commands

Dynamically Loading a Laravel Package Without Composer Dump-Autoload

I have a Laravel package located in the packages/ directory, and I want to load and register it dynamically without manually running composer dump-autoload or any CLI commands.

Requirements:

  1. The package should be discovered and available after visiting a specific route (e.g., /discover-package).
  2. It should be persistently available, even after clearing the cache, sessions, or restarting the server.
  3. The solution should be fully programmatic, meaning any new package added should be automatically detected and loaded.
  4. The package’s Service Provider and classes must be autoloaded correctly within Laravel’s application lifecycle.

Question:
Has anyone implemented a similar solution? What is the best way to achieve this dynamically in Laravel?

Upvotes: 0

Views: 28

Answers (0)

Related Questions