orangehill/generators
OrangeHill Generators provides Artisan-powered scaffolding for Laravel projects, helping developers quickly generate common classes and boilerplate files. It reduces repetitive setup work, speeds up new resource creation, and helps keep application structure consistent.
This package layers a set of make:* commands on top of Laravel 5's built-in generators so you can produce migrations, models, seeders, and pivot tables from a compact schema string instead of hand-writing boilerplate.
composer require orangehill/generators
config/app.php — this package predates package auto-discovery, so you must add it manually even on 5.5+:'providers' => [
// ...
Orangehill\Generators\GeneratorsServiceProvider::class,
],
php artisan list | grep 'make:'
You should see make:migration:schema, make:migration:pivot, make:seed, and make:scaffold (exact set varies by tag — check php artisan list output, not the README, which lags).
Where to look first: the command classes under src/ (each command's getArguments/getOptions reveals the real flags), then the stub files they render. The README documents the schema DSL but not every edge case.
First use case — generate and run a migration in one shot:
php artisan make:migration:schema create_posts_table \
--schema="user_id:integer:foreign,title:string,body:text"
php artisan migrate
That is the 80% path: you describe columns, the package writes Schema::create(...) with the right $table->string(), ->foreign(), etc., and you skip the round-trip through the migration stub.
Schema-string DSL. Columns are comma-separated, each name:type[:modifier[:modifier]]. Modifiers map to fluent calls:
php artisan make:migration:schema create_users_table \
--schema="name:string,email:string:unique,password:string,remember_token:string:nullable,timestamps"
:unique → ->unique():index → ->index():nullable → ->nullable():default(value) → ->default('value'):foreign → ->unsigned()->foreign() (add the referenced table via --foreign-keys or a companion pivot command)Generate a vertical slice in one command. The schema command accepts flags to fan out artifacts, which is where the package earns its keep day-to-day:
php artisan make:migration:schema create_invoices_table \
--schema="user_id:integer:foreign,amount:decimal,total:decimal,status:string" \
--model=1 --seed=1
This gives you migration + Eloquent model (with $fillable derived from the schema) + seeder. You then edit relations and casts by hand — the generator gives you a correct skeleton, not a finished domain model.
Pivot tables. Never hand-write many-to-many joins:
php artisan make:migration:pivot users roles
The package alphabetizes the table names (role_user) and generates both key columns with the correct foreign keys — matching Laravel's convention, which hand-written pivots routinely violate.
Scaffolding as a starting point, not a finish line. make:scaffold (with --schema) emits model + controller + migration in one pass. Use it to bootstrap a CRUD resource, then immediately strip what you don't need. Treat the output as a diff candidate, not committed code.
Scripted project bootstrapping. Because the schema is a single argument, these commands compose well in a bootstrap.sh or a Makefile target. This is the strongest real-world use: reproducible schema generation across dev/staging databases and new team members, rather than ad-hoc artisan tinker work.
Seeder generation. php artisan make:seed users creates UsersTableSeeder. It does not register itself in DatabaseSeeder — wire that call yourself.
Version lock is the headline risk. This package is unmaintained (0 stars, 0 dependents, last meaningful activity around Laravel 5.x). It will not install cleanly on Laravel 6+, and its generated code may not match current conventions (typed properties, foreignId()->constrained(), anonymous class migrations). Pin it in a legacy project; for greenfield work use laravel-shift/blueprint or doctrine/dbal-backed tooling instead.
Commas are the delimiter, so default values are hostile. :default(foo,bar) will split into two columns and produce a broken migration. Avoid commas in defaults, or hand-edit after generation.
Quote the schema in the shell. Unquoted --schema="a:string:unique" is usually fine, but any $ or ( in a default value will be eaten by bash. Prefer single quotes:
--schema='status:string:default(pending)'
timestamps and soft deletes are inconsistent across tags. Some versions accept a bare timestamps token; others require you to add it manually. Always open the generated migration and confirm $table->timestamps() is present before running migrate.
Foreign keys need the referenced table spelled out. :foreign alone gives you an unsigned column; the actual constraint may need the --foreign-keys flag or manual ->references('id')->on('users'). Check the generated file — a missing constraint fails silently at insert time, not at migration time.
Generated files are timestamp-prefixed and never overwrite. Re-running a command creates a second migration, not a patch. Delete the stale file before regenerating, or you'll end up with duplicate Schema::create calls that blow up on migrate.
No auto-registration of seeders. make:seed writes the class but leaves DatabaseSeeder::run() untouched. Add $this->call(UsersTableSeeder::class); yourself — a common source of "seeder works locally, not in CI" confusion.
Debugging generated output. Run with -v to see the resolved paths, then diff the rendered stub against src/*/stubs/ in the vendor directory to understand why a column came out wrong. If a command errors on parsing, the schema string (not the package) is almost always the culprit — isolate it to a single column and add modifiers back one at a time.
Extension points. Subclass the command classes and re-register them in your own service provider if you need custom column types (JSON, enums, spatial) — the built-in DSL doesn't cover them. If the package publishes a config (php artisan vendor:publish --provider="Orangehill\Generators\GeneratorsServiceProvider"), check it for model/seed path overrides before hardcoding namespaces.
How can I help you explore Laravel packages today?