PHPackages                             braunstetter/control-panel-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. [Templating &amp; Views](/categories/templating)
4. /
5. braunstetter/control-panel-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

braunstetter/control-panel-bundle
=================================

A collection of extensible templates for building great control panels in order to build your software systems.

v0.2.35(3y ago)171[1 issues](https://github.com/Braunstetter/ControlPanelBundle/issues)1MITPHPPHP ^8.0

Since Aug 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Braunstetter/ControlPanelBundle)[ Packagist](https://packagist.org/packages/braunstetter/control-panel-bundle)[ RSS](/packages/braunstetter-control-panel-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (8)Versions (39)Used By (1)

ControlPanelBundle
==================

[](#controlpanelbundle)

[![Build Status](https://camo.githubusercontent.com/b5a2141c36e895f8f91bf549631bd31b1edb2ecb2e21c5d7d14dedd3cfa86644/68747470733a2f2f6170702e7472617669732d63692e636f6d2f427261756e737465747465722f436f6e74726f6c50616e656c42756e646c652e7376673f6272616e63683d6d61696e)](https://app.travis-ci.com/Braunstetter/ControlPanelBundle)[![Total Downloads](https://camo.githubusercontent.com/ae68cb97180ed968b13557ed00ea1bc8091969ce8e8567375a85b345aee917b9/687474703a2f2f706f7365722e707567782e6f72672f627261756e737465747465722f636f6e74726f6c2d70616e656c2d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/braunstetter/control-panel-bundle)[![License](https://camo.githubusercontent.com/14fe8496d72238282d7ff16983bdc90439beb58927be4dc67a27faaee7e42ede/687474703a2f2f706f7365722e707567782e6f72672f627261756e737465747465722f636f6e74726f6c2d70616e656c2d62756e646c652f6c6963656e7365)](https://packagist.org/packages/braunstetter/control-panel-bundle)

Sometimes you don't want to commit to a complete admin system. But you would like to have a nice admin panel structure ready to be extended.

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

[](#installation)

```
composer require braunstetter/control-panel-bundle
yarn install --force
```

What's inside
-------------

[](#whats-inside)

### Templates

[](#templates)

- [layouts/base.html.twig](Resources/views/layouts/base.html.twig) (Mobile structure - but empty)
- [base.html.twig](Resources/views/base.html.twig) (contains structure with template hooks)

You can extend these templates, but you can also use the [braunstetter/template-hooks-bundle](https://github.com/Braunstetter/TemplateHooksBundle) whose hooks are used inside of the `base.html.twig` file.

### FormTypes

[](#formtypes)

This bundle comes with several [custom form types](https://symfony.com/doc/current/form/create_custom_field_type.html). To show you how you can use it, I want to show you an [example](#pagetype-example).

*To make this work you need an `OrangePuppy` [Entity](https://symfony.com/doc/current/doctrine.html#creating-an-entity-class) with a title and a description property on it.*

Example - Up and running a fully working controlpanel
-----------------------------------------------------

[](#example---up-and-running-a-fully-working-controlpanel)

### Create a new symfony project.

[](#create-a-new-symfony-project)

```
symfony new --full my_project
composer install
```

### Setup the database

[](#setup-the-database)

For this simple test just use a sqlite database by changing the `.env` file to:

```
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
#DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###
```

```
symfony console doctrine:database:create
```

### Create a Controller with a route

[](#create-a-controller-with-a-route)

```
symfony console make:controller

 Choose a name for your controller class (e.g. DeliciousElephantController):
 > SiteController

 created: src/Controller/SiteController.php
 created: templates/site/index.html.twig

  Success!

```

### Edit the twig template

[](#edit-the-twig-template)

Change `templates/site/index.html.twig`:

```
{% extends '@ControlPanel/base.html.twig' %}

{% block title %}Hello SiteController!{% endblock %}

{% block content %}
```

> Note: don't forget to change the block name from `body` to `content`

### Start the webserver and visit your control panel

[](#start-the-webserver-and-visit-your-control-panel)

```
symfony serve -d
```

Now you can see the result by visiting the `/site` url.

[![Empty control panel](docs/images/empty_control_panel.png)](docs/images/empty_control_panel.png)

PageType Example
----------------

[](#pagetype-example)

```
