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

Ng Admin Generator Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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:

  1. Confirm the API shape. The bundle only understands APIs built with 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.
  2. Install and register. 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.
  3. Find the command, don't guess it. Run 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.
  4. Look here first when something is wrong:
    • vendor/marmelab/ng-admin-generator-bundle/Resources/config/ — service wiring and the default output template.
    • The bundle's 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.
    • The generated JS file itself — it is plain ng-admin config and is the fastest way to see what the generator inferred.

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.

Implementation Patterns

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.

Gotchas and Tips

  • Archived and unmaintained. Zero dependents, no commits, Symfony 2/3-era code. It will not survive a PHP 8 or Doctrine 3 upgrade. Budget for a fork or a rewrite, and do not introduce it into anything with a multi-year lifespan.
  • AngularJS is EOL. ng-admin is AngularJS 1.x. The generated config is only useful if you are also committing to running a dead frontend framework. This is the real reason to skip the package, more than the PHP side.
  • Laravel is the wrong host. No Laravel integration exists. If you are considering this for a Laravel app, the equivalent is php artisan make:filament-resource — same idea, maintained, and Eloquent-aware.
  • Reflection sees only the mapping. Custom DQL, virtual/computed properties, non-Doctrine data sources, and service-backed endpoints are invisible. Expect to hand-write those entities entirely.
  • Field order is mapping order. Column order in the Doctrine mapping dictates list/view order, which rarely matches what a human wants. Override explicitly rather than reordering the schema.
  • Date/time format drift. Doctrine 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.
  • Pluralisation and route naming. Generated entity names derive from class names. Acronyms and compound names produce awkward routes (/api/legal_entities vs /api/legalentity). Check the base URL and entity name together, against the actual LemonRestBundle route table (bin/console debug:router).
  • Debugging order: (1) dump the intermediate config from the generator service rather than the final JS, (2) node --check the output for syntax errors, (3) network tab for _filters/_sort payloads, (4) only then suspect the bundle.
  • Extension points: the generator is a container service — decorate or subclass it, and swap the output template via the bundle's Twig resource. That is the supported way to customise; editing vendor files is not, because the next composer update erases it.
  • Security default is "expose everything." Every mapped field appears in list, show, and create forms. Password hashes, internal flags, and audit columns will leak into the UI unless you blacklist them explicitly — and they should be excluded at the serialiser level regardless.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource