This does everything for you, from the Composer requirement to the addition of Laravel service providers.
$ composer require displore/widgets
This requires the addition of the Widgets service provider and Widgets facade alias to config/app.php if you use the package with Laravel.
In the configuration file you can set up dynamic resolving or register the widgets in a similar fashion to how config/app.php works with aliases.
The package does not rely on Laravel, as shows the following example.
$arrayOfProviders= ['headline'=>My\Widgets\Headline::class,];$service=newWidgetsProvider($arrayOfProviders);$widget=$service->get('headline'); // Calls getWidget() on the Headline class.
With Laravel, the array of providers is found in a dedicated configuration file. In your views you can call the Widget facade to get widgets.
It is also possible, either with or without Laravel, to use a dynamic widgets provider, meaning that on every request, all classes in a given path will be searched for the widget needed. Especially useful during development.
For Laravel, set dynamic to true in the configuration file. For non-laravel: