Tutorial: Administration backend create symfony


In this post, I'm going with Symfony 4 an Administartionsoberfläche with the help of Sonata create and describe the steps.

1. Create a new symfony project

With composer can be quickly skeleton project creating a new symfony:

composer create-project symfony/website-skeleton my-admin-demo

The skeleton project contains the main symfony components for a Web application and doctrine.

Now is a good time to check in the Porjket in a Versionierungsystem like GIT and to commit for the first time.

Optionally, symfony PHPUnit bridge can now be installed, When tests should be written:

composer require phpunit --dev

The database can now be configured in the .env file:

DATABASE_URL=mysql://db_user:%MINIFYHTML1131a8ce0e6db790490bfd896742af7f9%:3306/db_name

And are created with the following command:

php bin/console doctrine:database:create

2. Installation of the SonataAdmin bundle

This is for the creation of administration interfaces in symfony SonataAdmin bundle have been created and offers all possibilities, order to realise simple up to very extensive administration interfaces.

composer require sonata-project/admin-bundle

The SonataAdmin bundle requires yet an another bundle to the communication with the database, in the case of doctrine:

composer require sonata-project/doctrine-orm-admin-bundle

To view the backend, must be installed yet an .htaccess file, in the case of Apache Web server:

composer require symfony/apache-pack

Then the SonataAdmin should appear in the browser interface under:

https://localhost/my-admin-demo/public/admin/dashboard

SonataAdmin interface

Now you can add your own administration interfaces: Sonata documentation.

In most cases the Administration Panel by using a user should secured authentication in the form of a login form, This can be with the help of the SonataUserBundle or even without be done.

Comments are closed.