Last active
January 13, 2018 19:30
-
-
Save COil/3a82e91f1f8e451ea7ddc490dee3ad65 to your computer and use it in GitHub Desktop.
phpinfo() action for the easy admin bundle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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