Skip to content

Instantly share code, notes, and snippets.

@COil
Last active January 13, 2018 19:30
Show Gist options
  • Save COil/3a82e91f1f8e451ea7ddc490dee3ad65 to your computer and use it in GitHub Desktop.
Save COil/3a82e91f1f8e451ea7ddc490dee3ad65 to your computer and use it in GitHub Desktop.
phpinfo() action for the easy admin bundle
<?php
// src/AppBundle/Controller/Admin/AdminController.php
namespace AppBundle\Controller\Admin;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AdminController as BaseAdminController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Extends the easy admin default controller for custom actions.
*
* @Route("/admin")
*/
class AdminController extends BaseAdminController
{
/**
* @Route("/phpinfo", name="easyadmin_phpinfo")
*/
public function phpInfoAction(): Response
{
if ($this->container->has('profiler')) {
$this->container->get('profiler')->disable();
}
ob_start();
phpinfo();
$str = ob_get_contents();
ob_get_clean();
return new Response($str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment