feat: phase 0 foundation — InsForge REST client, config, env wiring, dev account

This commit is contained in:
sean
2026-08-25 17:31:29 +07:00
parent 8c01282084
commit 046cefc56c
8 changed files with 233 additions and 5 deletions
@@ -0,0 +1,29 @@
<?php
namespace App\Services\InsForge;
use RuntimeException;
class InsForgeException extends RuntimeException
{
public function __construct(
public readonly ?string $errorCode,
public readonly int $statusCode,
string $message,
) {
parent::__construct($message, $statusCode);
}
public static function fromResponse(int $statusCode, array|string $body): self
{
if (is_array($body)) {
return new self(
$body['error'] ?? null,
$body['statusCode'] ?? $statusCode,
$body['message'] ?? 'InsForge request failed',
);
}
return new self(null, $statusCode, $body !== '' ? $body : "InsForge request failed with status {$statusCode}");
}
}