You can do this in two ways:
- Register your mid-range product with your mid-tier provider.
- Register the intermediate product inside your package. Service provider
first try one create file of your TestMiddleware.php file in your src package folder and put it somewhere, in my case I placed it inside the Middle-ware folder and then add it to your composer.json autoloader for example:
"autoload": { "psr-4": { "Vendor\\Package\\Middleware": "packages/Vendor/Package/src/Middleware" } }
And write your overall average:
namespace Vendor\Package\Middleware; class TestMiddleware { public function handle( $request, Closure $next ) { echo 'hello, world!'; } }
Then add the Tool to the main main menu of the project, in Lumen you should add it as follows:
$app->middleware([ Vendor\Package\Middleware\TestMiddleware::class ]);
Adding an intermediate product to a service provider
And secondly, create a medium version and upload it to the autoloader, as in the last example, and then create a service provider and register your download method in the middle:
public function boot() { $this->app->middleware([ \Vendor\Package\Middleware\TestMiddleware::class ]); }
And finally, you must register your service provider in your main project (Lumen example)
$app->register(Vendor\Package\TestServiceProvider::class);
source share