@artilingo/artiframe-cli 1.1.2 → 1.2.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.
Files changed (33) hide show
  1. package/bin/artiframe.js +1 -1
  2. package/core-stubs/docs/de.html +99 -6
  3. package/core-stubs/docs/en.html +100 -7
  4. package/core-stubs/docs/es.html +99 -6
  5. package/core-stubs/docs/fr.html +100 -7
  6. package/core-stubs/docs/tr.html +95 -2
  7. package/package.json +2 -1
  8. package/src/App.php +11 -0
  9. package/src/Commands/AddCommand.php +18 -4
  10. package/src/Commands/MakeApiCommand.php +1 -1
  11. package/src/Commands/MakeClassCommand.php +1 -1
  12. package/src/Commands/MakeViewCommand.php +1 -1
  13. package/src/Commands/ModeCommand.php +71 -0
  14. package/src/Lang/de.php +7 -0
  15. package/src/Lang/en.php +7 -0
  16. package/src/Lang/es.php +7 -0
  17. package/src/Lang/fr.php +7 -0
  18. package/src/Lang/tr.php +7 -0
  19. package/stubs/make/api-standart.stub +20 -0
  20. package/stubs/make/api-switch-case.stub +38 -0
  21. package/stubs/make/class.stub +25 -0
  22. package/stubs/make/view.stub +30 -0
  23. package/stubs/service/phpmailer.stub +143 -0
  24. package/stubs/service/qrcode.stub +169 -0
  25. /package/{core-stubs/stubs → stubs}/service/image.stub +0 -0
  26. /package/{core-stubs/stubs → stubs}/service/iyzico.stub +0 -0
  27. /package/{core-stubs/stubs → stubs}/service/jwt.stub +0 -0
  28. /package/{core-stubs/stubs → stubs}/service/pusher.stub +0 -0
  29. /package/{core-stubs/stubs → stubs}/service/redis.stub +0 -0
  30. /package/{core-stubs/stubs → stubs}/service/s3.stub +0 -0
  31. /package/{core-stubs/stubs → stubs}/service/sentry.stub +0 -0
  32. /package/{core-stubs/stubs → stubs}/service/stripe.stub +0 -0
  33. /package/{core-stubs/stubs → stubs}/service/twilio.stub +0 -0
@@ -0,0 +1,38 @@
1
+ <?php
2
+ /**
3
+ * ArtiFrame Core Engine
4
+ *
5
+ * @package ArtiFrame
6
+ * @author Artilingo
7
+ * @license AGPLv3 (Attribution-ShareAlike Required)
8
+ */
9
+
10
+ // İzin verilen HTTP metodları (Örn: GET, POST, PUT, DELETE)
11
+ $allowedMethods = ['POST'];
12
+
13
+ require_once $_SERVER['DOCUMENT_ROOT'] . '/../app/ApiControl.php';
14
+
15
+ use Bin\SystemMethod;
16
+
17
+ $action = sanitizeString($_POST['action'] ?? '');
18
+
19
+ switch ($action) {
20
+ case 'create':
21
+ // TODO: Oluşturma işlemleri
22
+ jsonResponse(['status' => 'success', 'message' => 'Başarıyla oluşturuldu.'], 200);
23
+ break;
24
+
25
+ case 'update':
26
+ // TODO: Güncelleme işlemleri
27
+ jsonResponse(['status' => 'success', 'message' => 'Başarıyla güncellendi.'], 200);
28
+ break;
29
+
30
+ case 'delete':
31
+ // TODO: Silme işlemleri
32
+ jsonResponse(['status' => 'success', 'message' => 'Başarıyla silindi.'], 200);
33
+ break;
34
+
35
+ default:
36
+ jsonResponse(['status' => 'error', 'message' => 'Geçersiz veya eksik action parametresi.'], 400);
37
+ break;
38
+ }
@@ -0,0 +1,25 @@
1
+ <?php
2
+ /**
3
+ * ArtiFrame Core Engine
4
+ *
5
+ * @package ArtiFrame
6
+ * @author Artilingo
7
+ * @license AGPLv3 (Attribution-ShareAlike Required)
8
+ * @link https://artiframe.artilingo.com
9
+ *
10
+ * NOTICE: This file is part of the ArtiFrame ecosystem.
11
+ * Any derivative works or patches MUST retain this original copyright notice
12
+ * and remain open-source under the AGPLv3 license.
13
+ */
14
+
15
+ namespace {{NAMESPACE}};
16
+
17
+ use Bin\SystemMethod;
18
+
19
+ class {{CLASS_NAME}}
20
+ {
21
+ public function __construct()
22
+ {
23
+ // Constructor logic
24
+ }
25
+ }
@@ -0,0 +1,30 @@
1
+ <?php
2
+ // Tek giriş noktası: DotEnv → APP_ENV/APP_VERSION → ViewMethod
3
+ require_once $_SERVER['DOCUMENT_ROOT'] . '/../app/ViewControl.php';
4
+ use Bin\ViewMethod;
5
+ ?>
6
+ <!DOCTYPE html>
7
+ <html lang="{{LANG}}" data-theme="default" data-mode="light">
8
+ <head>
9
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/head.php'; ?>
10
+
11
+ <title>{{VIEW_TITLE}}</title>
12
+
13
+ <!-- View-Specific Assets with Cache-Busting -->
14
+ <link rel="stylesheet" href="{{CSS_PATH}}?v=<?= APP_VERSION ?>">
15
+ <script src="{{JS_PATH}}?v=<?= APP_VERSION ?>" defer></script>
16
+ </head>
17
+ <body>
18
+ <!-- Top Navigation -->
19
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?>
20
+
21
+ <main class="main-content">
22
+ <h1>{{VIEW_TITLE}}</h1>
23
+ <!-- View content starts here -->
24
+
25
+ </main>
26
+
27
+ <!-- Footer -->
28
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
29
+ </body>
30
+ </html>
@@ -0,0 +1,143 @@
1
+ <?php
2
+ namespace App\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
+ }
@@ -0,0 +1,169 @@
1
+ <?php
2
+ namespace App\Service;
3
+
4
+ use Endroid\QrCode\QrCode as EndroidQrCode;
5
+ use Endroid\QrCode\Color\Color;
6
+ use Endroid\QrCode\Encoding\Encoding;
7
+ use Endroid\QrCode\ErrorCorrectionLevel;
8
+ use Endroid\QrCode\Logo\Logo;
9
+ use Endroid\QrCode\Writer\PngWriter;
10
+ use Endroid\QrCode\Writer\SvgWriter;
11
+ use Endroid\QrCode\Writer\Result\ResultInterface;
12
+
13
+ /**
14
+ * ArtiFrame QR Code Wrapper for endroid/qr-code
15
+ *
16
+ * Provides a clean, fluent API to generate QR Codes easily without dealing
17
+ * with Builder/Writer instantiations and deep namespace imports.
18
+ */
19
+ class QrCode
20
+ {
21
+ private EndroidQrCode $qrCode;
22
+ private ?Logo $logo = null;
23
+ private $writer;
24
+ private Color $foregroundColor;
25
+ private Color $backgroundColor;
26
+
27
+ /**
28
+ * Initializes a new QR Code with the given string data.
29
+ */
30
+ public function __construct(string $data)
31
+ {
32
+ $this->qrCode = EndroidQrCode::create($data)
33
+ ->setEncoding(new Encoding('UTF-8'))
34
+ ->setErrorCorrectionLevel(ErrorCorrectionLevel::High)
35
+ ->setSize(300)
36
+ ->setMargin(10);
37
+
38
+ $this->foregroundColor = new Color(0, 0, 0);
39
+ $this->backgroundColor = new Color(255, 255, 255);
40
+ $this->writer = new PngWriter();
41
+ }
42
+
43
+ /**
44
+ * Instantiates a new QrCode instance for fluent chaining.
45
+ */
46
+ public static function generate(string $data): self
47
+ {
48
+ return new self($data);
49
+ }
50
+
51
+ /**
52
+ * Set the width/height of the QR Code in pixels.
53
+ */
54
+ public function size(int $size): self
55
+ {
56
+ $this->qrCode->setSize($size);
57
+ return $this;
58
+ }
59
+
60
+ /**
61
+ * Set the white margin around the QR Code in pixels.
62
+ */
63
+ public function margin(int $margin): self
64
+ {
65
+ $this->qrCode->setMargin($margin);
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Set the foreground (module) and background colors.
71
+ * Expects hex values like '#000000' and '#ffffff'.
72
+ */
73
+ public function color(string $hexForeground, string $hexBackground = '#ffffff'): self
74
+ {
75
+ $this->foregroundColor = $this->hexToColor($hexForeground);
76
+ $this->backgroundColor = $this->hexToColor($hexBackground);
77
+
78
+ $this->qrCode->setForegroundColor($this->foregroundColor);
79
+ $this->qrCode->setBackgroundColor($this->backgroundColor);
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * Embed a logo image in the center of the QR Code.
85
+ *
86
+ * @param string $path Absolute path to the logo file.
87
+ * @param int $width Width of the logo in pixels.
88
+ * @param bool $punchoutBackground Cut a white hole for the logo.
89
+ */
90
+ public function logo(string $path, int $width = 50, bool $punchoutBackground = false): self
91
+ {
92
+ if (file_exists($path)) {
93
+ $this->logo = Logo::create($path)
94
+ ->setResizeToWidth($width)
95
+ ->setPunchoutBackground($punchoutBackground);
96
+ }
97
+ return $this;
98
+ }
99
+
100
+ /**
101
+ * Set output format (png or svg). Defaults to png.
102
+ */
103
+ public function format(string $format): self
104
+ {
105
+ $format = strtolower($format);
106
+ if ($format === 'svg') {
107
+ $this->writer = new SvgWriter();
108
+ } else {
109
+ $this->writer = new PngWriter();
110
+ }
111
+ return $this;
112
+ }
113
+
114
+ /**
115
+ * Generate the ResultInterface holding the rendered image.
116
+ */
117
+ private function getResult(): ResultInterface
118
+ {
119
+ // Colors might have been updated
120
+ $this->qrCode->setForegroundColor($this->foregroundColor);
121
+ $this->qrCode->setBackgroundColor($this->backgroundColor);
122
+
123
+ return $this->writer->write(
124
+ $this->qrCode,
125
+ $this->logo
126
+ );
127
+ }
128
+
129
+ /**
130
+ * Save the QR Code to a physical file.
131
+ */
132
+ public function save(string $path): void
133
+ {
134
+ $this->getResult()->saveToFile($path);
135
+ }
136
+
137
+ /**
138
+ * Return the QR Code as a base64 Data URI string.
139
+ * Ready to be used in HTML: <img src="<?= QrCode::generate('x')->base64() ?>">
140
+ */
141
+ public function base64(): string
142
+ {
143
+ return $this->getResult()->getDataUri();
144
+ }
145
+
146
+ /**
147
+ * Output the image directly to the browser with proper HTTP Headers.
148
+ */
149
+ public function output(): void
150
+ {
151
+ $result = $this->getResult();
152
+ header('Content-Type: ' . $result->getMimeType());
153
+ echo $result->getString();
154
+ exit;
155
+ }
156
+
157
+ /**
158
+ * Convert HEX color (#FFFFFF) to Endroid Color object.
159
+ */
160
+ private function hexToColor(string $hex): Color
161
+ {
162
+ $hex = ltrim($hex, '#');
163
+ if (strlen($hex) === 3) {
164
+ $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
165
+ }
166
+ list($r, $g, $b) = sscanf($hex, "%02x%02x%02x");
167
+ return new Color((int)$r, (int)$g, (int)$b);
168
+ }
169
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes