Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Lumen Generators Laravel Package

wn/lumen-generators

wn/lumen-generators adds Laravel-style Artisan generator commands to Lumen, so you can quickly scaffold models, controllers, middleware, migrations, seeders, requests, and other common classes. It brings familiar make:* workflows and faster scaffolding to Lumen apps that lack them.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install as a dev dependency so scaffolding commands never ship to production:
    composer require --dev wn/lumen-generators
    
  • Lumen does not auto-discover providers, so register the package’s service provider manually in bootstrap/app.php:
    $app->register(Wn\LumenGenerators\LumenGeneratorsServiceProvider::class);
    
    Check the package README for the exact FQCN if your installed version differs.
  • Because the package is dev-only, guard the registration if you deploy with composer install --no-dev:
    if ($app->runningInConsole() && class_exists(Wn\LumenGenerators\LumenGeneratorsServiceProvider::class)) {
        $app->register(Wn\LumenGenerators\LumenGeneratorsServiceProvider::class);
    }
    
  • Confirm the commands are registered:
    php artisan list
    
    You should see make:controller, make:model, make:migration, make:seeder, make:middleware, and similar generators depending on the package version.
  • First practical use case—scaffold a model, migration, and controller for a new resource:
    php artisan make:model Post -m
    php artisan make:controller PostController
    php artisan make:seeder PostsTableSeeder
    
  • Look first at php artisan help make:controller and the package README for supported options. Then inspect each generated file; the generators produce boilerplate, not a finished feature.

Implementation Patterns

  • Use the generators as a “vertical slice” starter: model + migration + controller + seeder + middleware in one pass, then hand-edit the generated files. This is faster than copying files from Laravel and keeps naming consistent.
  • Generate migrations with conventional names so the migrator picks them up correctly:
    php artisan make:migration create_posts_table
    php artisan make:migration add_status_to_posts_table --table=posts
    
    The generated class name and filename timestamp follow Laravel’s migration conventions.
  • Generate controllers into subdirectories when you want namespaced controllers:
    php artisan make:controller Admin/PostController
    
    Verify the generated namespace matches your PSR-4 mapping; adjust manually if your app namespace differs from App\.
  • Middleware generation only writes the class. You still have to wire it up in bootstrap/app.php:
    $app->middleware([
        App\Http\Middleware\Authenticate::class,
    ]);
    
    $app->routeMiddleware([
        'auth' => App\Http\Middleware\Authenticate::class,
    ]);
    
  • For generated console commands, register them in app/Console/Kernel.php under the $commands array. Lumen does not auto-register command classes the way some Laravel setups do.
  • Models generated by the package assume Eloquent is enabled. In Lumen, call $app->withEloquent() in bootstrap/app.php and configure DB_* environment variables before expecting generated models or seeders to work.
  • Seeders are not auto-run. Either add the generated seeder to DatabaseSeeder or invoke it explicitly:
    php artisan db:seed --class=PostsTableSeeder
    
  • In team workflows, record the exact generator commands in a Makefile, Composer script, or onboarding doc. Scaffolding becomes repeatable, and reviewers know which files came from a generator versus hand-written logic.
  • Commit generator output separately from your edits when possible. A commit containing only generated boilerplate makes the subsequent “real” implementation diff much easier to review.
  • Treat generated controllers as a starting point for Lumen’s style—Lumen’s base controller is minimal. Add validation, authorization, and response formatting yourself rather than assuming Laravel’s default traits are present.

Gotchas and Tips

  • The last release was in 2017 and targets Lumen/Laravel 5.x. Do not add it to a modern Laravel or Lumen project; built-in make: commands cover this functionality, and old command signatures may break against newer framework versions.
  • The most common failure is “command not found.” Check, in order: the provider is registered in bootstrap/app.php; you ran composer dump-autoload; you are running php artisan from the project root; and the provider registration is not accidentally skipped by a runningInConsole() guard during local testing.
  • Lumen does not support package auto-discovery. Forgetting the manual $app->register(...) line is the usual reason the generators appear to be “installed but missing.”
  • If you register the provider unconditionally and deploy with --no-dev, bootstrap will fail with a class-not-found error. Wrap registration in class_exists() and/or console-only checks.
  • Generated files assume the App\ namespace and Lumen’s default app/ directory. If your application uses a custom namespace or directory layout, edit the generated namespaces and paths, or fork the package stubs.
  • On case-sensitive filesystems, class names and filenames must match exactly. A generated PostController.php containing class Postcontroller will fail on Linux even if it works on macOS.
  • Generated controllers may reference Laravel traits or middleware that Lumen does not include by default, such as ValidatesRequests or AuthorizesRequests. Add the traits or remove the references based on what your Lumen app actually provides.
  • Migrations require a working database configuration and $app->withEloquent(). The generator only writes the migration file; it does not configure the database or run the migration.
  • Run php -l on generated PHP files and composer dump-autoload -o after scaffolding. This catches syntax issues and autoload mismatches early.
  • The package’s extension point is its stubs and generator command classes under vendor/wn/lumen-generators/. If you need project-specific scaffolding, copy the stubs or write a small custom Artisan command rather than editing files inside vendor/.
  • Pin the version in composer.json and commit composer.lock. Given the 2017 release date, expect no upstream fixes; treat it as a frozen development convenience for legacy Lumen 5.x codebases.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo