Please consider to use fruitcake/laravel-cors, that is part of Laravel core.
A Simple Cross Origin Resource Sharing for Lumen Framework.
Note: That should works fine on Laravel Framework too, but the tests are performed to Lumen.
composer require "vluzrmos/lumen-cors=2.1.*"
On boostrap/app.php
register the middleware:
$app->middleware([
//...,
'Vluzrmos\LumenCors\CorsMiddleware'
]);
You are free to use ::class notation.
And that is it!
That package stands to be free of configurations, then if you want a more configurable package please consider to see one of these: