@artilingo/artiframe-cli 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core-stubs/bin/SystemMethod.php +600 -521
- package/core-stubs/bin/ViewMethod.php +591 -393
- package/core-stubs/docs/de.html +853 -1172
- package/core-stubs/docs/en.html +585 -904
- package/core-stubs/docs/es.html +934 -1253
- package/core-stubs/docs/fr.html +913 -1232
- package/core-stubs/docs/tr.html +4212 -5021
- package/package.json +1 -1
- package/src/App.php +38 -0
- package/src/Commands/AddCommand.php +1 -1
- package/src/Commands/AuthCommand.php +219 -0
- package/src/Commands/IssuesCommand.php +174 -0
- package/src/Commands/ListCommand.php +2 -1
- package/src/Commands/MakeApiCommand.php +1 -1
- package/src/Commands/MakeClassCommand.php +1 -1
- package/src/Commands/MakeViewCommand.php +1 -1
- package/src/Commands/NewProjectCommand.php +37 -25
- package/src/Commands/RemoveCommand.php +21 -10
- package/src/Commands/ServeCommand.php +29 -9
- package/src/Commands/SuggestCommand.php +143 -0
- package/src/Commands/TableCommand.php +2 -1
- package/src/Commands/UpgradeCommand.php +209 -0
- package/src/Commands/VersionCommand.php +2 -1
- package/src/Lang/de.php +9 -1
- package/src/Lang/en.php +8 -0
- package/src/Lang/es.php +9 -1
- package/src/Lang/fr.php +8 -0
- package/src/Lang/tr.php +10 -2
- package/src/Services/Safeguard.php +25 -0
- package/stubs/service/image.stub +334 -334
- package/stubs/service/iyzico.stub +637 -637
- package/stubs/service/jwt.stub +312 -312
- package/stubs/service/phpmailer.stub +143 -143
- package/stubs/service/pusher.stub +232 -232
- package/stubs/service/qrcode.stub +169 -169
- package/stubs/service/redis.stub +361 -361
- package/stubs/service/s3.stub +377 -377
- package/stubs/service/sentry.stub +76 -106
- package/stubs/service/stripe.stub +526 -526
- package/stubs/service/twilio.stub +361 -361
- package/core-stubs/app/R2Manager.php +0 -130
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
namespace
|
|
3
|
-
|
|
4
|
-
use PHPMailer\PHPMailer\PHPMailer;
|
|
5
|
-
use PHPMailer\PHPMailer\Exception;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* ArtiFrame Mailer Wrapper for PHPMailer
|
|
9
|
-
*
|
|
10
|
-
* Provides a clean, fluent API on top of the battle-tested PHPMailer library.
|
|
11
|
-
* Handles complex RFC standards, TLS handshakes, and CRLF injections automatically.
|
|
12
|
-
*/
|
|
13
|
-
class Mailer
|
|
14
|
-
{
|
|
15
|
-
private PHPMailer $mail;
|
|
16
|
-
|
|
17
|
-
public function __construct()
|
|
18
|
-
{
|
|
19
|
-
$this->mail = new PHPMailer(true);
|
|
20
|
-
|
|
21
|
-
// SMTP Configuration from .env
|
|
22
|
-
$this->mail->isSMTP();
|
|
23
|
-
$this->mail->Host = $_ENV['MAIL_HOST'] ?? 'localhost';
|
|
24
|
-
$this->mail->SMTPAuth = !empty($_ENV['MAIL_USERNAME']);
|
|
25
|
-
$this->mail->Username = $_ENV['MAIL_USERNAME'] ?? '';
|
|
26
|
-
$this->mail->Password = $_ENV['MAIL_PASSWORD'] ?? '';
|
|
27
|
-
|
|
28
|
-
$encryption = strtolower($_ENV['MAIL_ENCRYPTION'] ?? '');
|
|
29
|
-
if ($encryption === 'tls') {
|
|
30
|
-
$this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
|
31
|
-
} elseif ($encryption === 'ssl') {
|
|
32
|
-
$this->mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
$this->mail->Port = $_ENV['MAIL_PORT'] ?? 25;
|
|
36
|
-
|
|
37
|
-
// Security & Formatting Defaults
|
|
38
|
-
$this->mail->CharSet = 'UTF-8';
|
|
39
|
-
$this->mail->Encoding = 'base64';
|
|
40
|
-
|
|
41
|
-
$this->mail->setFrom(
|
|
42
|
-
$_ENV['MAIL_FROM_ADDRESS'] ?? 'hello@example.com',
|
|
43
|
-
$_ENV['MAIL_FROM_NAME'] ?? 'ArtiFrame'
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Instantiates a new Mailer instance for fluent chaining.
|
|
49
|
-
*/
|
|
50
|
-
public static function create(): self
|
|
51
|
-
{
|
|
52
|
-
return new self();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Add a primary recipient.
|
|
57
|
-
*/
|
|
58
|
-
public function to(string $email, string $name = ''): self
|
|
59
|
-
{
|
|
60
|
-
$this->mail->addAddress($email, $name);
|
|
61
|
-
return $this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Add a Carbon Copy (CC) recipient.
|
|
66
|
-
*/
|
|
67
|
-
public function cc(string $email, string $name = ''): self
|
|
68
|
-
{
|
|
69
|
-
$this->mail->addCC($email, $name);
|
|
70
|
-
return $this;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Add a Blind Carbon Copy (BCC) recipient.
|
|
75
|
-
*/
|
|
76
|
-
public function bcc(string $email, string $name = ''): self
|
|
77
|
-
{
|
|
78
|
-
$this->mail->addBCC($email, $name);
|
|
79
|
-
return $this;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Set the email subject.
|
|
84
|
-
*/
|
|
85
|
-
public function subject(string $subject): self
|
|
86
|
-
{
|
|
87
|
-
$this->mail->Subject = $subject;
|
|
88
|
-
return $this;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Set the body format to HTML. Automatically generates an AltBody (Plain Text) version.
|
|
93
|
-
*/
|
|
94
|
-
public function html(string $html, ?string $altText = null): self
|
|
95
|
-
{
|
|
96
|
-
$this->mail->isHTML(true);
|
|
97
|
-
$this->mail->Body = $html;
|
|
98
|
-
$this->mail->AltBody = $altText ?? strip_tags(str_replace(['<br>', '<br/>'], "\n", $html));
|
|
99
|
-
return $this;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Set the body format to strict Plain Text.
|
|
104
|
-
*/
|
|
105
|
-
public function text(string $text): self
|
|
106
|
-
{
|
|
107
|
-
$this->mail->isHTML(false);
|
|
108
|
-
$this->mail->Body = $text;
|
|
109
|
-
return $this;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Attach a file (PDF, DOCX, ZIP, etc.)
|
|
114
|
-
*/
|
|
115
|
-
public function attach(string $path, string $name = ''): self
|
|
116
|
-
{
|
|
117
|
-
$this->mail->addAttachment($path, $name);
|
|
118
|
-
return $this;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Embed an inline image for HTML rendering (e.g., logo).
|
|
123
|
-
* Usage in HTML: <img src="cid:YOUR_CID">
|
|
124
|
-
*/
|
|
125
|
-
public function embedImage(string $path, string $cid, string $name = ''): self
|
|
126
|
-
{
|
|
127
|
-
$this->mail->addEmbeddedImage($path, $cid, $name);
|
|
128
|
-
return $this;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Execute the SMTP transmission.
|
|
133
|
-
* @throws \Exception
|
|
134
|
-
*/
|
|
135
|
-
public function send(): bool
|
|
136
|
-
{
|
|
137
|
-
try {
|
|
138
|
-
return $this->mail->send();
|
|
139
|
-
} catch (Exception $e) {
|
|
140
|
-
throw new \Exception("SMTP Mailer Error: " . $this->mail->ErrorInfo);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
1
|
+
<?php
|
|
2
|
+
namespace Src\Service;
|
|
3
|
+
|
|
4
|
+
use PHPMailer\PHPMailer\PHPMailer;
|
|
5
|
+
use PHPMailer\PHPMailer\Exception;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ArtiFrame Mailer Wrapper for PHPMailer
|
|
9
|
+
*
|
|
10
|
+
* Provides a clean, fluent API on top of the battle-tested PHPMailer library.
|
|
11
|
+
* Handles complex RFC standards, TLS handshakes, and CRLF injections automatically.
|
|
12
|
+
*/
|
|
13
|
+
class Mailer
|
|
14
|
+
{
|
|
15
|
+
private PHPMailer $mail;
|
|
16
|
+
|
|
17
|
+
public function __construct()
|
|
18
|
+
{
|
|
19
|
+
$this->mail = new PHPMailer(true);
|
|
20
|
+
|
|
21
|
+
// SMTP Configuration from .env
|
|
22
|
+
$this->mail->isSMTP();
|
|
23
|
+
$this->mail->Host = $_ENV['MAIL_HOST'] ?? 'localhost';
|
|
24
|
+
$this->mail->SMTPAuth = !empty($_ENV['MAIL_USERNAME']);
|
|
25
|
+
$this->mail->Username = $_ENV['MAIL_USERNAME'] ?? '';
|
|
26
|
+
$this->mail->Password = $_ENV['MAIL_PASSWORD'] ?? '';
|
|
27
|
+
|
|
28
|
+
$encryption = strtolower($_ENV['MAIL_ENCRYPTION'] ?? '');
|
|
29
|
+
if ($encryption === 'tls') {
|
|
30
|
+
$this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
|
31
|
+
} elseif ($encryption === 'ssl') {
|
|
32
|
+
$this->mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
$this->mail->Port = $_ENV['MAIL_PORT'] ?? 25;
|
|
36
|
+
|
|
37
|
+
// Security & Formatting Defaults
|
|
38
|
+
$this->mail->CharSet = 'UTF-8';
|
|
39
|
+
$this->mail->Encoding = 'base64';
|
|
40
|
+
|
|
41
|
+
$this->mail->setFrom(
|
|
42
|
+
$_ENV['MAIL_FROM_ADDRESS'] ?? 'hello@example.com',
|
|
43
|
+
$_ENV['MAIL_FROM_NAME'] ?? 'ArtiFrame'
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Instantiates a new Mailer instance for fluent chaining.
|
|
49
|
+
*/
|
|
50
|
+
public static function create(): self
|
|
51
|
+
{
|
|
52
|
+
return new self();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Add a primary recipient.
|
|
57
|
+
*/
|
|
58
|
+
public function to(string $email, string $name = ''): self
|
|
59
|
+
{
|
|
60
|
+
$this->mail->addAddress($email, $name);
|
|
61
|
+
return $this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Add a Carbon Copy (CC) recipient.
|
|
66
|
+
*/
|
|
67
|
+
public function cc(string $email, string $name = ''): self
|
|
68
|
+
{
|
|
69
|
+
$this->mail->addCC($email, $name);
|
|
70
|
+
return $this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Add a Blind Carbon Copy (BCC) recipient.
|
|
75
|
+
*/
|
|
76
|
+
public function bcc(string $email, string $name = ''): self
|
|
77
|
+
{
|
|
78
|
+
$this->mail->addBCC($email, $name);
|
|
79
|
+
return $this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Set the email subject.
|
|
84
|
+
*/
|
|
85
|
+
public function subject(string $subject): self
|
|
86
|
+
{
|
|
87
|
+
$this->mail->Subject = $subject;
|
|
88
|
+
return $this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Set the body format to HTML. Automatically generates an AltBody (Plain Text) version.
|
|
93
|
+
*/
|
|
94
|
+
public function html(string $html, ?string $altText = null): self
|
|
95
|
+
{
|
|
96
|
+
$this->mail->isHTML(true);
|
|
97
|
+
$this->mail->Body = $html;
|
|
98
|
+
$this->mail->AltBody = $altText ?? strip_tags(str_replace(['<br>', '<br/>'], "\n", $html));
|
|
99
|
+
return $this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Set the body format to strict Plain Text.
|
|
104
|
+
*/
|
|
105
|
+
public function text(string $text): self
|
|
106
|
+
{
|
|
107
|
+
$this->mail->isHTML(false);
|
|
108
|
+
$this->mail->Body = $text;
|
|
109
|
+
return $this;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Attach a file (PDF, DOCX, ZIP, etc.)
|
|
114
|
+
*/
|
|
115
|
+
public function attach(string $path, string $name = ''): self
|
|
116
|
+
{
|
|
117
|
+
$this->mail->addAttachment($path, $name);
|
|
118
|
+
return $this;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Embed an inline image for HTML rendering (e.g., logo).
|
|
123
|
+
* Usage in HTML: <img src="cid:YOUR_CID">
|
|
124
|
+
*/
|
|
125
|
+
public function embedImage(string $path, string $cid, string $name = ''): self
|
|
126
|
+
{
|
|
127
|
+
$this->mail->addEmbeddedImage($path, $cid, $name);
|
|
128
|
+
return $this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Execute the SMTP transmission.
|
|
133
|
+
* @throws \Exception
|
|
134
|
+
*/
|
|
135
|
+
public function send(): bool
|
|
136
|
+
{
|
|
137
|
+
try {
|
|
138
|
+
return $this->mail->send();
|
|
139
|
+
} catch (Exception $e) {
|
|
140
|
+
throw new \Exception("SMTP Mailer Error: " . $this->mail->ErrorInfo);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|