1. Go to this page and download the library: Download prometa/laravel-modules library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
prometa / laravel-modules example snippets
namespace App\traffic;
use Illuminate\Support\Facades\Route;
use Prometa\BootstrapModules\BootstrapsModule;
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
use BootstrapsModule;
public function map(): void
{
Route::middleware('web')
->group(__DIR__ . '/routes.php');
}
}
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
use BootstrapsModule { register as registerModule; boot as bootModule; }
public function register(): void
{
$this->registerModule(); // trait logic
// your bindings...
}
public function boot(): void
{
$this->bootModule(); // trait logic
// your boot logic...
}
}
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
use BootstrapsModule;
public function map(): void
{
Route::middleware('web')
->prefix('traffic')
->name('traffic::')
->group(__DIR__ . '/routes.php');
}
}
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
use BootstrapsModule { register as registerModule; }
public function register(): void
{
$this->registerModule();
$this->routes(function () {
Route::middleware('web')
->prefix('traffic')
->name('traffic::')
->group(__DIR__ . '/routes.php');
});
}
}