Skip to content

Commit 2776065

Browse files
committed
feat: support TemplateNamePrefix in DSN #0000
1 parent be4f85a commit 2776065

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Client.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,18 @@ public static function fromDsn($dsn): Client
5656
$transportAccount = $pathPart[2];
5757
}
5858

59-
return new self($username, $password, $apiUrl, $account, $library, $transportAccount);
59+
$client = new self($username, $password, $apiUrl, $account, $library, $transportAccount);
60+
61+
if (!empty($part['query'])) {
62+
parse_str($part['query'], $query);
63+
foreach ($query as $key => $value) {
64+
if ('template_name_prefix' === $key) {
65+
$client->setTemplateNamePrefix($value);
66+
}
67+
}
68+
}
69+
70+
return $client;
6071
}
6172

6273
public function send(MessageInterface $message, $skipNamePrefix = false)
@@ -337,7 +348,7 @@ private function parseAddresses($addresses)
337348
return $res;
338349
}
339350

340-
public function setTemplateNamePrefix($prefix)
351+
public function setTemplateNamePrefix(string $prefix): Client
341352
{
342353
$this->templateNamePrefix = $prefix;
343354

0 commit comments

Comments
 (0)