If you ever need to register a middleware within your package so it can be used by a laravel project/application, it is possible to register this within the package's service provider boot() method.

Firstly, this will require creating a middleware file (I would typically place this within a src/Middleware/ folder).

Once this is done, you can update the package's service provider with the following:

// src/ExamplePackageServiceProvider.php


public function boot()

Till next time.