PHPackages                             marmelab/ng-admin-generator-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. marmelab/ng-admin-generator-bundle

AbandonedArchivedSymfony-bundle[HTTP &amp; Networking](/categories/http)

marmelab/ng-admin-generator-bundle
==================================

Bundle to generate easily a ng-admin configuration file based on your LemonRestBundle based API

0.2.0(11y ago)752.4k11[6 issues](https://github.com/marmelab/NgAdminGeneratorBundle/issues)[1 PRs](https://github.com/marmelab/NgAdminGeneratorBundle/pulls)MITPHPPHP &gt;=5.4

Since Feb 24Pushed 7y ago15 watchersCompare

[ Source](https://github.com/marmelab/NgAdminGeneratorBundle)[ Packagist](https://packagist.org/packages/marmelab/ng-admin-generator-bundle)[ Docs](https://github.com/marmelab/NgAdminGeneratorBundle)[ RSS](/packages/marmelab-ng-admin-generator-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (8)Used By (0)

  [![archived](https://camo.githubusercontent.com/742c4e1d1cee10950fdbcf8cec4cdfb2f650d7d83c0fe0d065a460c50515f2be/68747470733a2f2f63646e6a732e636c6f7564666c6172652e636f6d2f616a61782f6c6962732f6f637469636f6e732f382e352e302f7376672f617263686976652e737667)](https://camo.githubusercontent.com/742c4e1d1cee10950fdbcf8cec4cdfb2f650d7d83c0fe0d065a460c50515f2be/68747470733a2f2f63646e6a732e636c6f7564666c6172652e636f6d2f616a61782f6c6962732f6f637469636f6e732f382e352e302f7376672f617263686976652e737667) **Archived Repository**
 This code is no longer maintained. Feel free to fork it, but use it at your own risks.  NgAdminGeneratorBundle [![Build Status](https://camo.githubusercontent.com/a282dbfb7af491e8bba29de9362814cc066c1ec5739317451bf3e12c30ba4489/68747470733a2f2f7472617669732d63692e6f72672f6d61726d656c61622f4e6741646d696e47656e657261746f7242756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/marmelab/NgAdminGeneratorBundle)
===================================================================================================================================================================================================================================================================================================================================================

[](#ngadmingeneratorbundle-)

You're a fan of [StanLemonRestBundle](https://github.com/stanlemon/rest-bundle) because it makes REST APIs based on Doctrine entities a piece of cake? You starred [ng-admin](https://github.com/marmelab/ng-admin) because you love the idea of a JavaScript-powered administration panel consuming a REST API? Then, you will love NgAdminGeneratorBundle, the Symfony2 bundle that bootstraps ng-admin based on a Doctrine-powered REST API!

Installation
------------

[](#installation)

### Setting up bundle

[](#setting-up-bundle)

Using this bundle in your own project is pretty straightforward, thanks to composer:

`composer require marmelab/ng-admin-generator-bundle`

Then, register it to your `AppKernel.php` file. The NgAdminGeneratorBundle should only be used in development:

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        // ...
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new \marmelab\NgAdminGeneratorBundle\marmelabNgAdminGeneratorBundle();
        }
        // ...
    }
}
```

No more configuration, you are now ready to go!

### ng-admin template sample

[](#ng-admin-template-sample)

Here is a Twig template to render your favorite administration panel:

```

    Administration Panel

```

If you got a blank page, ensure you have set correctly the `ng-app` and `ui-view` attributes.

Generating your ng-admin configuration
--------------------------------------

[](#generating-your-ng-admin-configuration)

This bundle just adds the `ng-admin:configuration:generate` command to your application. By default, it outputs a JavaScript configuration based on [the REST API defined by StanLemonRestBundle](https://github.com/stanlemon/rest-bundle/blob/master/Resources/doc/index.md#adding-support-for-your-doctrine-entities) into STDOUT. You are free to redirect STDOUT into the file of your choice:

```
./app/console ng-admin:configuration:generate > public/js/ng-admin-config.js

```

Tip: Thanks to the Symfony2 Console component, you can truncate parts of the command name and call the `ng-admin:c:g` command!

Configuration sample
--------------------

[](#configuration-sample)

Here is a sample of an auto-generated configuration, based on the [stanlemon/rest-demo-app](https://github.com/stanlemon/rest-demo-app)demo application. This application sets up the same entities as the official [ng-admin demo app](http://ng-admin.marmelab.com/), i.e. Posts, Comments, and Tags. The generator simply uses [entity mapping](https://github.com/stanlemon/rest-demo-app/tree/master/src/Lemon/RestDemoBundle/Entity) to better know which fields to use.

```
var app = angular.module('myApp', ['ng-admin']);

// Deal with query parameters expected by StanLemon bundle
app.config(function(RestangularProvider) {
    RestangularProvider.addFullRequestInterceptor(function(element, operation, what, url, headers, params) {
        if (operation == "getList") {
            // custom pagination params
            params._start = (params._page - 1) * params._perPage;
            params._end = params._page * params._perPage;
            delete params._page;
            delete params._perPage;

            // custom sort params
            if (params._sortField) {
                params._orderBy = params._sortField;
                params._orderDir = params._sortDir;
                delete params._sortField;
                delete params._sortDir;
            }

            // custom filters
            if (params._filters) {
                for (var filter in params._filters) {
                    params[filter] = params._filters[filter];
                }
                delete params._filters;
            }
        }

        return { params: params };
    });
});

/* Define a `config` block for each entity, allowing to split configuration
   across several files. */
app.config(function($provide, NgAdminConfigurationProvider) {
    $provide.factory("PostAdmin", function() {
        var nga = NgAdminConfigurationProvider;
        var post = nga.entity('post');

        // Dashboard (as list) won't display referenced list of items.
        post.dashboardView()
            .fields([
                nga.field('id', 'number'),
                nga.field('title', 'string'),
                nga.field('body', 'text'),
                // We limit to 3 number of fields displayed on dashboard
            ]);

        post.listView()
            .fields([
                nga.field('id', 'number'),
                nga.field('title', 'string'),
                nga.field('body', 'text'),
                // Take more meaningful field. Here, use `name` instead of `id`
                nga.field('tags', 'reference_many')
                    .targetEntity(nga.entity('tag'))
                    .targetField(nga.field('name')),
            ])
            .listActions(['show', 'edit', 'delete']);

        post.creationView()
            .fields([
                // Do not display id: we don't have any yet
                nga.field('title', 'string'),
                nga.field('body', 'text'),
                nga.field('tags', 'reference_many')
                    .targetEntity(nga.entity('tag'))
                    .targetField(nga.field('name')),
                // No referenced_list either, as that's a brand new entity
            ]);

        post.editionView()
            .fields([
                nga.field('id', 'number').readOnly(), // don't modify id
                nga.field('title', 'string'),
                nga.field('body', 'text'),
                nga.field('tags', 'reference_many')
                    .targetEntity(nga.entity('tag'))
                    .targetField(nga.field('name')),
                nga.field('comments', 'referenced_list')
                    .targetEntity(nga.entity('comment'))
                    .targetReferenceField('post_id')
                    .targetFields([
                        nga.field('id', 'number'),
                        nga.field('body', 'text'),
                        nga.field('created_at', 'date'),

                ]),
            ]);

        /* To ease configuration per view, we repeat every field every time. If you want to display same fields
           across views, you can use for instance `post.editView().fields()` to get edition fields. */
        post.showView()
            .fields([
                nga.field('id', 'number'),
                nga.field('title', 'string'),
                nga.field('body', 'text'),
                nga.field('tags', 'reference_many')
                    .targetEntity(nga.entity('tag'))
                    .targetField(nga.field('name')),
                nga.field('comments', 'referenced_list')
                    .targetEntity(nga.entity('comment'))
                    .targetReferenceField('post_id')
                    .targetFields([
                        nga.field('id', 'number'),
                        nga.field('body', 'text'),
                        nga.field('created_at', 'date'),

                ]),
            ]);

        return post;
    });
});

// Same config block for comments
// Same config block for tags

app.config(function(NgAdminConfigurationProvider, PostAdminProvider, CommentAdminProvider, TagAdminProvider) {
    var admin = NgAdminConfigurationProvider
        .application('')
        .baseApiUrl(location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + '/api/')

    admin
        .addEntity(PostAdminProvider.$get())
        .addEntity(CommentAdminProvider.$get())
        .addEntity(TagAdminProvider.$get())
    ;

    NgAdminConfigurationProvider.configure(admin);
});
```

Contributing
------------

[](#contributing)

Your feedback about the usage of this bundle is valuable: don't hesitate to [open GitHub Issues](https://github.com/marmelab/ng-admin/issues)for any problem or question you may have.

All contributions are welcome. New applications or options should be tested with the `phpunit` command.

License
-------

[](#license)

NgAdminGeneratorBundle is licensed under the [MIT Licence](LICENSE), courtesy of [marmelab](http://marmelab.com).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Total

4

Last Release

4029d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f276b595dd9581609d98da7840529bd04270494eec30a70106dc77f26c7ddb18?d=identicon)[jpetitcolas](/maintainers/jpetitcolas)

---

Top Contributors

[![jpetitcolas](https://avatars.githubusercontent.com/u/688373?v=4)](https://github.com/jpetitcolas "jpetitcolas (62 commits)")[![fzaninotto](https://avatars.githubusercontent.com/u/99944?v=4)](https://github.com/fzaninotto "fzaninotto (25 commits)")[![stanlemon](https://avatars.githubusercontent.com/u/86314?v=4)](https://github.com/stanlemon "stanlemon (11 commits)")[![alexisjanvier](https://avatars.githubusercontent.com/u/547706?v=4)](https://github.com/alexisjanvier "alexisjanvier (1 commits)")[![jeromehubert](https://avatars.githubusercontent.com/u/1310375?v=4)](https://github.com/jeromehubert "jeromehubert (1 commits)")[![RobinBressan](https://avatars.githubusercontent.com/u/4641116?v=4)](https://github.com/RobinBressan "RobinBressan (1 commits)")

---

Tags

restadministrationng-admin

### Embed Badge

![Health badge](/badges/marmelab-ng-admin-generator-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/marmelab-ng-admin-generator-bundle/health.svg)](https://phpackages.com/packages/marmelab-ng-admin-generator-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M650](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
