1. Go to this page and download the library: Download wyrihaximus/json-throwable 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/ */
wyrihaximus / json-throwable example snippets
declare(strict_types=1);
final class ExposeTraceException extends Exception
{
/** @var array<array<string, mixed>> */
private array $originalTrace = [];
/**
* @return array<array<string, mixed>>
*/
public function getOriginalTrace(): array
{
return $this->originalTrace;
}
}
declare(strict_types=1);
use WyriHaximus\ExposeTraceTrait;
final class ExposeTraceException extends Exception
{
use ExposeTraceTrait;
}
declare(strict_types=1);
use WyriHaximus\AdditionalPropertiesInterface;
use WyriHaximus\ExposeTraceTrait;
final class AdditionalPropertiesException extends Exception implements AdditionalPropertiesInterface
{
use ExposeTraceTrait;
private int $time;
public function __construct(int $time)
{
parent::__construct('Additional properties exception raised');
$this->time = $time;
}
public function time(): int
{
return $this->time;
}
/**
* @return array<string>
*/
public function additionalProperties(): array
{
return ['time'];
}
}