marmelab/ng-admin-generator-bundle
A Symfony bundle that generates ng-admin back-office configurations from Doctrine entities, automatically mapping fields and relations to CRUD views and forms so you can expose admin panels with minimal boilerplate.
This is a Symfony bundle, not a Laravel package — there is no service provider, no config/ng_admin.php, and no Artisan command. As a Laravel developer you will only encounter it inside a legacy Symfony codebase (or a client hand-off), and you should treat it as a one-shot scaffolding tool rather than a runtime dependency.
Minimum path to first value:
marmelab/lemon-rest-bundle, which exposes Doctrine entities as REST resources with _page, _perPage, _sort, _filters query params. If the API is hand-rolled (Laravel, API Platform, plain Symfony controllers), this bundle has nothing to introspect and will produce an empty or wrong config.composer require marmelab/ng-admin-generator-bundle, then add the bundle to app/AppKernel.php (new Marmelab\NgAdminGeneratorBundle\NgAdminGeneratorBundle()) on Symfony 2/3, or to config/bundles.php on Symfony 4. It will not install cleanly on modern stacks — expect to pin PHP 7.x and old Doctrine versions, or vendor a fork.bin/console list | grep -i ng-admin (or bin/console list ng-admin). The bundle's whole surface is essentially one generator command plus a config block; there is no documented stable API to memorise.vendor/marmelab/ng-admin-generator-bundle/Resources/config/ — service wiring and the default output template.DependencyInjection/Configuration.php — the actual, authoritative list of config keys (entity overrides, output path, API base URL). The README is thin and partly outdated; the Configuration tree is not.First use case: point the generator at one LemonRestBundle resource, dump the resulting config.js fragment, and load it into an ng-admin admin.run(...) bootstrap. That gets you a list/create/edit screen for a single entity in an afternoon — which is the entire value proposition.
For a Laravel shop, the honest translation is: this is what Filament or Nova do natively, and what you'd otherwise hand-write as a Blade/Inertia admin. Only invest here if the Symfony app already exists.
Entity → entity block generation. The generator reads Doctrine mapping metadata and emits one ng-admin entity per LemonRestBundle resource, with field types inferred from column types (string → string, text → text, datetime → datetime, integer FK → reference). Treat the output as a first draft, not a spec — plan for a human pass over every entity.
Keep generated output and hand-written overrides separate. The single most important pattern: never let the generator write directly into the file you edit.
// generated.config.js — regenerated, committed, never hand-edited
// admin.config.js — your overrides, merged at runtime
angular.module('myApp')
.config(['NgAdminConfigurationProvider', function (nga) {
var admin = nga.application('Backoffice')
.baseApiUrl('/api/');
// apply generated entities, then patch them
generatedEntities.forEach(function (e) { admin.addEntity(e); });
}]);
Regenerate to a temp path, diff it against the committed version, and review — the generator is not stable enough to trust with a blind overwrite.
Model the relations deliberately. Many-to-one maps to nga.field('author', 'reference'); one-to-many maps to referenced_list. If a related entity is not exposed through LemonRestBundle, the generated reference will point at a route that 404s. Either expose the entity or explicitly drop the field in your override layer — there is no graceful degradation.
Wire filters to the LemonRestBundle contract. ng-admin's filters array must produce the _filters JSON blob LemonRestBundle expects, and pagination() must emit _page/_perPage. Verify in the network tab rather than in the generated source; a mismatch shows up as silently ignored filters, which is easy to misread as a generator bug.
Use template fields as the escape hatch. Computed columns, status badges, avatar thumbnails, and anything the generator cannot infer all go through nga.field('x', 'template').template('<span>...</span>') added in your override layer. Do not try to teach the generator about them.
Generation as a build step, not a dev-time ritual. Run the command in CI to surface drift (schema changed, config stale) and lint the output with node --check. Fail the build on a non-empty diff so nobody discovers the breakage in production.
Auth and roles. The bundle generates an anonymous admin. Add an interceptor for your token/cookie and post-process entities per role in the override layer. Note that hiding a field in ng-admin is cosmetic only — the API must enforce it.
php artisan make:filament-resource — same idea, maintained, and Eloquent-aware.datetime → ng-admin's date input is a classic mismatch (timezone, Y-m-d H:i:s vs ISO 8601). Test edit-then-save round trips, not just display./api/legal_entities vs /api/legalentity). Check the base URL and entity name together, against the actual LemonRestBundle route table (bin/console debug:router).node --check the output for syntax errors, (3) network tab for _filters/_sort payloads, (4) only then suspect the bundle.composer update erases it.How can I help you explore Laravel packages today?