laravelpackage-development

How to autoload Service provider in Laravel package development


I'm trying to develop a very simple Laravel package for learning purpose. I want to display a simple message like 'Hello World' when I call /demo route. I've installed my package in a Laravel project with the following command:

composer require onbiponi/message:dev-master

And then,

composer dump-autoload

Now, I can't access /demo route. I get the error:

Sorry, the page you are looking for could not be found.

I noticed the boot method of MessageServiceProvider is not being triggered. Do I need to manually add this service provider to config/app.php or do I need need to add something manually? But I want to do everything automatically after installation. Here is my package in github: https://github.com/rejauldu/message


Solution

  • Autoload service provider only exist from Laravel 5.5. It will not work with 5.4