1. Go to this page and download the library: Download pioniro/wrapper-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pioniro / wrapper-bundle example snippets
/**
* @Annotation
*/
class LogException implements \Pioniro\WrapperBundle\AnnotationInterface
{
}
class LogExceptionHandler implements \Pioniro\WrapperBundle\HandlerInterface
{
public function __construct(private \Psr\Log\LoggerInterface $logger) {}
public function handle(callable $next, array $args, AnnotationInterface $annotation): callable
{
return function ($input) use ($next) {
try{
return $next($input);
} catch (\Throwable $exception) {
$this->logger->error($exception->getMessage(), compact('exception'));
throw $exception;
}
}
public static function handledClass(): string
{
return LogException::class;
}
}
class MyService
{
#[LogException]
public function doSomethingWithPHP8(): void
{
throw new \Exception('Something went wrong');
}
/**
* @LogException
*/
protected function doSomethingWithPHP7(): void
{
throw new \Exception('Something went wrong');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.