Code generators and scaffolding tools for the Neuron PHP framework.
composer require --dev neuron-php/scaffoldingGenerate a complete, runnable Neuron ORM CRUD stack — model, DTO YAML, repository (interface + database implementation), an attribute-routed controller, and field-aware views — with a single command.
# From an explicit field spec (creates a new table + migration)
php neuron scaffold:generate Post \
--fields="title:string,body:text,published:boolean"
# From an existing database table (introspects columns; skips migration)
php neuron scaffold:generate Docket --from-table=jud_docketThe --from-table path introspects the live schema via PDO
(information_schema.columns on MySQL/PostgreSQL, PRAGMA table_info on
SQLite) using the project's configured connection, so it is the primary path
for mapping existing GroupOffice tables.
Large legacy tables (e.g. jud_docket) often have many columns you don't want
in the editing UI. Inspect the columns first, then narrow the editable
surface with --only or --except:
# 1. See what's there (prints columns + types, generates nothing)
php neuron scaffold:generate Docket --from-table=jud_docket --list-fields
# 2. Expose just the columns you need
php neuron scaffold:generate Docket --from-table=jud_docket \
--only="case_number,status,filed_date,judge_id"
# ...or keep everything except a few
php neuron scaffold:generate Docket --from-table=jud_docket \
--except="created_by,modified_by,acl_id"--only / --except affect only the DTO and views — the model,
repository, and migration always map the complete table, so inserts and
updates that touch NOT NULL columns keep working. The primary key is always
retained. (--only and --except are mutually exclusive.)
Generated controllers use PHP 8 route attributes (#[Get] / #[Post] …) — no
routes.yaml is written. Unsafe-method routes are tagged with
filters: ['csrf'], and forms emit csrf_field(); both are provided by the
framework-level CSRF support in neuron-php/mvc (enabled by default via the
security.csrf setting), so no per-app wiring is required.
After generation, bind the repository interface to its database implementation
in your service provider, e.g. IPostRepository → DatabasePostRepository.
php neuron controller:generate UserController --type=resourcephp neuron event:generate UserRegistered --property="userId:int" --property="email:string"
php neuron listener:generate SendWelcomeEmail --event="App\Events\UserRegistered"php neuron job:generate SendEmailReminders --cron="0 9 * * *"php neuron initializer:generate QueueInitializerphp neuron db:migration:generate CreateUsersTablephp neuron mail:generate welcomeVisit neuronphp.com for full documentation.