desino/boilerplate

Desino in-house Laravel boilerplate: auth, user management, app config, and Blade scaffolding via Artisan.

Maintainers

Package info

github.com/desino/LaravelBoilerPlate

pkg:composer/desino/boilerplate

Statistics

Installs: 37

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.2 2026-05-27 07:16 UTC

This package is auto-updated.

Last update: 2026-05-27 07:16:31 UTC


README

Latest Version on Packagist Total Downloads License

In-house Laravel starter kit by Desino. Publishes authentication, user management, app configuration, Blade layouts, and related scaffolding into an existing Laravel application via a single Artisan command.

Current stable release: v1.0.2 (Packagist: latest stable tag)

Requirements

  • PHP ^8.1
  • Laravel ^10, ^11, ^12, ^13, or ^14

Installation

Install the package with Composer (installs the latest stable release, currently v1.0.2):

composer require desino/boilerplate

To require a minimum version or pin exactly:

composer require desino/boilerplate:^1.0.2
# or
composer require desino/boilerplate:1.0.2

If you already installed an older tag, update in place:

composer update desino/boilerplate --with-dependencies

The service provider is auto-discovered. No manual registration is required.

Usage

Run the publish command once on a fresh or prepared Laravel app:

php artisan make:desino-boilerplate

Use --force to overwrite files that already exist (default: skip existing files).

This copies stubs into your application (controllers, models, migrations, views, frontend assets, routes, middleware, seeders, config, and translations). With --force, routes/web.php is replaced by the package stub; otherwise an existing routes/web.php is skipped.

Recommended dependencies

The publish command adds laravel/ui to your app composer.json require section (from composer.require.stub) when it is not already present. Edit the stub to add more packages if needed.

Then run:

composer update

Frontend assets

The command publishes resources/js, resources/css, and resources/sass (jQuery, Bootstrap 5, Font Awesome, bootstrap-select, datepicker CSS). resources/js/bootstrap.js exposes jQuery and bootstrap on window.

If your app has no package.json, the full stub is published. Otherwise missing entries from package.json.stub are merged into devDependencies, scripts, and overrides (existing packages are left unchanged).

The publish command removes Laravel Vite defaults when present: vite.config.js, vite.config.ts, public/hot, public/build, and Vite-related npm packages/scripts (this boilerplate uses Laravel Mix instead).

Build compiled assets expected by the layout (public/css/app.min.css, public/js/app.min.js):

npm install
npm run prod

The publish command copies default images to public/images/ (logo.png, loading.svg, etc.). Add public/favicon.ico in the host app if needed.

Environment

APP_URL=http://localhost

# Optional: force HTTPS URLs in production
MYAPP_FORCE_HTTPS=true

# Database (standard Laravel)
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
DB_CHARSET=utf8
DB_COLLATION=utf8_unicode_ci

Database

Ensure the default Laravel users migration has been run, then run the published migrations:

php artisan migrate

The boilerplate adjusts the users table (first_name, last_name, usertype, status, audit columns) and creates app_configs.

Providers

The package Desino\Boilerplate\BoilerplateServiceProvider is registered automatically via Composer (Artisan command only). You do not add it to bootstrap/providers.php.

The publish command copies CheckUserIsActive and CheckUserIsAdmin into app/Http/Middleware/. You must register them manually in bootstrap/app.php (steps below). The command does not modify bootstrap/app.php, because project layouts differ.

The publish command appends this to bootstrap/providers.php when missing (Laravel 11+):

App\Providers\BladeDefaultVariablesServiceProvider::class,

On Laravel 10, add that class to the providers array in config/app.php if bootstrap/providers.php does not exist.

Middleware (Laravel 11, 12, and 13)

Laravel 11+ registers middleware in bootstrap/app.php inside ->withMiddleware(). The steps are the same for Laravel 11, 12, and 13.

Middleware Registration Purpose
CheckUserIsActive $middleware->web(append: [...]) Logs out deactivated users on every web request
CheckUserIsAdmin $middleware->alias([...]) as checkIfAdmin Admin-only routes (used with auth in routes/web.php)

Step 1 — Confirm middleware files exist

After php artisan make:desino-boilerplate, you should have:

  • app/Http/Middleware/CheckUserIsActive.php
  • app/Http/Middleware/CheckUserIsAdmin.php

Step 2 — Open bootstrap/app.php

At the top of the file, ensure this import exists (add it if missing):

use Illuminate\Foundation\Configuration\Middleware;

Step 3 — Register inside ->withMiddleware()

Find the Application::configure(...) chain. It must include ->withMiddleware(...).

If you already have an empty closure (common default):

->withMiddleware(function (Middleware $middleware) {
    //
})

Replace the // (or add below it) with:

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \App\Http\Middleware\CheckUserIsActive::class,
    ]);

    $middleware->alias([
        'checkIfAdmin' => \App\Http\Middleware\CheckUserIsAdmin::class,
    ]);
})

If ->withMiddleware() is missing entirely, add it to the configure chain (between ->withRouting(...) and ->withExceptions(...), for example):

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->web(append: [
            \App\Http\Middleware\CheckUserIsActive::class,
        ]);

        $middleware->alias([
            'checkIfAdmin' => \App\Http\Middleware\CheckUserIsAdmin::class,
        ]);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })
    ->create();

Step 4 — Confirm routes use the alias

Published routes/web.php should wrap admin routes like this:

Route::middleware(['auth', 'checkIfAdmin'])->group(function () {
    // users, appconfig, ...
});

Step 5 — Clear caches (if routes/middleware were cached)

php artisan optimize:clear

Troubleshooting

Symptom What to check
Inactive users can still browse CheckUserIsActive is inside web(append: [...]), not only registered as an alias
Admin routes return 404 / no middleware Alias is exactly checkIfAdmin and routes use 'checkIfAdmin', not 'admin'
Changes have no effect Run php artisan optimize:clear and retry in a private browser window

Laravel 10 only (legacy Http/Kernel)

If your app still has app/Http/Kernel.php and no bootstrap/app.php middleware configuration:

  1. Add to $middlewareAliases:
'checkIfAdmin' => \App\Http\Middleware\CheckUserIsAdmin::class,
  1. Append to the web key in $middlewareGroups:
\App\Http\Middleware\CheckUserIsActive::class,

Seed defaults

php artisan db:seed --class=DesinoBoilerplateSeeder

Creates default pagination config (items_per_page_users = 25).

Post-install checklist

  1. composer update (installs laravel/ui after composer.json merge)
  2. Configure .env (database, MYAPP_FORCE_HTTPS)
  3. Register middleware in bootstrap/app.php (see Middleware)
  4. Confirm bootstrap/providers.php includes BladeDefaultVariablesServiceProvider (auto-added when possible)
  5. Confirm routes/web.php was published (or merge admin routes from the package stub)
  6. npm install && npm run prod (after package.json merge; see Frontend assets)
  7. php artisan migrate
  8. php artisan db:seed --class=DesinoBoilerplateSeeder
  9. php artisan config:cache (optional, production)

User roles and status

Constant Value Meaning
User::ROLE_ADMIN 1 Super admin
User::ROLE_NRMLUSR 2 Normal user
User::STATUS_ACTIVE 1 Can log in
User::STATUS_INACTIVE 0 Blocked (middleware logs out)

Published structure

Path Description
app/Http/Controllers/Auth/* Login, password reset, registration (register disabled in routes)
app/Http/Controllers/UserController.php User CRUD, activate/deactivate
app/Http/Controllers/AppConfigController.php Pagination and app settings
app/Http/Middleware/CheckUserIsActive.php Active account enforcement
app/Http/Middleware/CheckUserIsAdmin.php Admin-only routes
database/seeders/DesinoBoilerplateSeeder.php Default config and admin user
routes/web.php Web routes including auth and admin group
app/Models/User.php Extended user model
app/Models/AppConfig.php Key/value app configuration
app/Services/AppMiscService.php Flash messages, breadcrumbs, config helper
config/myapp.php App-specific settings
lang/en/messages.php UI translations
resources/js, resources/css, resources/sass Frontend source (compile to public/)
webpack.mix.js Published when missing (Laravel Mix build)

Configuration

config/myapp.php:

'myapp_force_https' => env('MYAPP_FORCE_HTTPS', false),

When true, AppServiceProvider forces https for generated URLs.

Routes (summary)

Method URI Name Access
GET / home Public
GET/POST /login, /logout, password reset Laravel UI Guest / auth
GET/POST /manual-login manuallogin Guest
GET/POST /appconfig appconfig.config Admin
GET/POST /users, /users/create, /users/edit/{id} users.* Admin
POST /users/activate, /users/deactivate, /users/delete users.* Admin

Public registration is disabled (Auth::routes(['register' => false])).

SFTP export (optional)

AppMiscService::exportToFTP() exports tables to CSV on the sftp_export disk. Configure config/filesystems.php for your SFTP server before use.

Security notes

  • Run make:desino-boilerplate only on trusted environments; use --force carefully.
  • Do not run the command twice without resolving duplicate migrations.
  • Keep MYAPP_FORCE_HTTPS=true behind a reverse proxy that sets X-Forwarded-Proto correctly.

Releasing on Packagist (maintainers)

Composer installs git tags, not branch master. After merging changes to master:

  1. Update CHANGELOG.md for the new version.
  2. Commit, push, then tag and push the tag (example v1.0.2):
git tag -a v1.0.2 -m "v1.0.2: short summary of changes"
git push origin master
git push origin v1.0.2
  1. On packagist.org/packages/desino/boilerplate, click Update if the new tag does not appear within a few minutes (or enable the GitHub webhook in package settings for automatic updates).
  2. Verify: composer require desino/boilerplate:^1.0.2

First-time setup: submit https://github.com/desino/LaravelBoilerPlate on packagist.org/packages/submit.

See CHANGELOG.md for version history.

License

MIT — see LICENSE.

Support

Contact: india@desino.be