From 8b8b995f57f95828b923a3d4555a0980b2bd35cd Mon Sep 17 00:00:00 2001 From: Nikola Posa Date: Sun, 25 Jun 2017 21:47:42 +0200 Subject: [PATCH] Add usage examples. --- examples/setting_error_handler.php | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 examples/setting_error_handler.php diff --git a/examples/setting_error_handler.php b/examples/setting_error_handler.php new file mode 100644 index 0000000..624eb88 --- /dev/null +++ b/examples/setting_error_handler.php @@ -0,0 +1,43 @@ + [ + 'dsn' => 'mysql:dbname=test;host=127.0.0.1', + 'user' => 'root', + 'password' => 'secret', + ], + 'di' => [ + 'factories' => [ + //automatically registered during bootstrap + RunnerInterface::class => function () { + $runner = new WhoopsRunner(new Run()); + $runner->pushHandler(new LogHandler(new NullLogger())); + + return $runner; + }, + ] + ], +]; + +$bootstrap = new Bootstrap( + new StaticConfigLoader($config), + new ZendServiceManagerFactory() +); +/* @var $diContainer ContainerInterface */ +$diContainer = $bootstrap(); + +assert($diContainer->has(RunnerInterface::class));