Symfony

This is the official documentation of the forestadmin/laravel-forestadmin v2+ and forestadmin/symfony-forestadmin PHP agents.

Add dependency forestadmin/symfony-forestadmin to your symfony app

composer require forestadmin/symfony-forestadmin

Add the configuration to your config/routes.yaml file

forest_admin_bundle:
  resource: '@SymfonyForestAdminBundle/config/routes'
  type: directory

Run the following command in your terminal

php bin/console forest:install THE-KEY-PROVIDED-BY-FORESTADMIN

Once the installation is finish, you have a new configuration file (forest/symfony_forest_admin.php) and two environments variables in your .env

use ForestAdmin\AgentPHP\Agent\Utils\Env;
use ForestAdmin\AgentPHP\DatasourceDoctrine\DoctrineDatasource;
use ForestAdmin\SymfonyForestAdmin\Service\ForestAgent;

return static function (ForestAgent $forestAgent) {

    $forestAgent->addDatasource(
        new DoctrineDatasource(
            $forestAgent->getEntityManager(),
            [
                'url' => Env::get('DATABASE_URL'),
            ]
        ),
    )
        ->build();
};

Running

symfony serve

should be enough to be redirected to the "rate-install" page.

Last updated