Skip to content

Commit ac05b06

Browse files
symfony/http-foundation
1 parent c5f87a5 commit ac05b06

File tree

5 files changed

+60
-1
lines changed

5 files changed

+60
-1
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"ext-mbstring": "*",
1717
"symfony/var-dumper": "*",
1818
"symfony/console": "^6.0",
19+
"symfony/http-foundation": "^6.0",
1920
"cocur/slugify": "^4.2.0",
2021
"vlucas/phpdotenv": "^5.4.1",
2122
"phpmailer/phpmailer": "^6.9",

src/Mail.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
use Tamedevelopers\Support\Capsule\Manager;
99
use Tamedevelopers\Support\Traits\MailTrait;
1010

11+
/**
12+
* Mailer with dynamic fluent methods via __call.
13+
*
14+
* Magic methods documented for static analysis:
15+
* @method $this altBody(string $body)
16+
* @method $this altMessage(string $body)
17+
* @method $this reply(string $address, string|null $name = null)
18+
* @method $this replyTo(string $address, string|null $name = null)
19+
*/
1120
class Mail{
1221

1322
use MailTrait;

src/NumberToWords.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77
use Tamedevelopers\Support\Str;
88
use Tamedevelopers\Support\Traits\NumberToWordsTraits;
99

10+
/**
11+
* Number-to-words converter with dynamic fluent API via __call/__callStatic.
12+
*
13+
* Builder-style magic methods (documented for static analysis):
14+
* @method self iso(?string $code = null) Set currency by ISO-3 code
15+
* @method self cents(?bool $allow = false) Toggle cents handling
16+
* @method self value(string|float|int $number) Set the value to convert
17+
*
18+
* Static builder equivalents:
19+
* @method static self iso(?string $code = null)
20+
* @method static self cents(?bool $allow = false)
21+
* @method static self value(string|float|int $number)
22+
*/
1023
class NumberToWords
1124
{
1225
use NumberToWordsTraits;

src/Tame.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Tamedevelopers\Support\Server;
99
use Tamedevelopers\Support\Capsule\File;
1010
use Tamedevelopers\Support\Traits\TameTrait;
11+
use Symfony\Component\HttpFoundation\JsonResponse;
1112
use Tamedevelopers\Support\Traits\NumberToWordsTraits;
1213

1314
/**
@@ -51,6 +52,18 @@ class Tame {
5152
private const PBKDF2_SALT = "\x2d\xb7\x68\x1a";
5253

5354

55+
/**
56+
* Alias for `echoJson` method
57+
*
58+
* @param int $response
59+
* @param mixed $message
60+
* @return mixed
61+
*/
62+
public static function jsonEcho(int $response = 0, $message = null)
63+
{
64+
self::echoJson($response, $message);
65+
}
66+
5467
/**
5568
* Echo `json_encode` with response and message
5669
*
@@ -60,7 +73,27 @@ class Tame {
6073
*/
6174
public static function echoJson(int $response = 0, $message = null)
6275
{
63-
echo json_encode(['response' => $response, 'message' => $message]);
76+
header('Content-Type: application/json');
77+
echo json_encode([
78+
'response' => $response,
79+
'message' => $message,
80+
]);
81+
}
82+
83+
/**
84+
* Return a JSON response with status code and message
85+
*
86+
* @param int $response
87+
* @param mixed $message
88+
* @param int $statusCode
89+
* @return \Symfony\Component\HttpFoundation\JsonResponse
90+
*/
91+
public static function json(int $response = 0, $message = null, int $statusCode = 200)
92+
{
93+
return new JsonResponse([
94+
'response' => $response,
95+
'message' => $message,
96+
], $statusCode);
6497
}
6598

6699
/**

src/View.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
/**
1414
* View Wrapper
15+
*
16+
* Magic methods documented for static analysis:
17+
* @method static string render(string|null $viewPath = null, array $data = []) Render a view via static call
1518
*/
1619
class View{
1720

0 commit comments

Comments
 (0)