@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.
Files changed (41) hide show
  1. package/core-stubs/bin/SystemMethod.php +600 -521
  2. package/core-stubs/bin/ViewMethod.php +591 -393
  3. package/core-stubs/docs/de.html +853 -1172
  4. package/core-stubs/docs/en.html +585 -904
  5. package/core-stubs/docs/es.html +934 -1253
  6. package/core-stubs/docs/fr.html +913 -1232
  7. package/core-stubs/docs/tr.html +4212 -5021
  8. package/package.json +1 -1
  9. package/src/App.php +38 -0
  10. package/src/Commands/AddCommand.php +1 -1
  11. package/src/Commands/AuthCommand.php +219 -0
  12. package/src/Commands/IssuesCommand.php +174 -0
  13. package/src/Commands/ListCommand.php +2 -1
  14. package/src/Commands/MakeApiCommand.php +1 -1
  15. package/src/Commands/MakeClassCommand.php +1 -1
  16. package/src/Commands/MakeViewCommand.php +1 -1
  17. package/src/Commands/NewProjectCommand.php +37 -25
  18. package/src/Commands/RemoveCommand.php +21 -10
  19. package/src/Commands/ServeCommand.php +29 -9
  20. package/src/Commands/SuggestCommand.php +143 -0
  21. package/src/Commands/TableCommand.php +2 -1
  22. package/src/Commands/UpgradeCommand.php +209 -0
  23. package/src/Commands/VersionCommand.php +2 -1
  24. package/src/Lang/de.php +9 -1
  25. package/src/Lang/en.php +8 -0
  26. package/src/Lang/es.php +9 -1
  27. package/src/Lang/fr.php +8 -0
  28. package/src/Lang/tr.php +10 -2
  29. package/src/Services/Safeguard.php +25 -0
  30. package/stubs/service/image.stub +334 -334
  31. package/stubs/service/iyzico.stub +637 -637
  32. package/stubs/service/jwt.stub +312 -312
  33. package/stubs/service/phpmailer.stub +143 -143
  34. package/stubs/service/pusher.stub +232 -232
  35. package/stubs/service/qrcode.stub +169 -169
  36. package/stubs/service/redis.stub +361 -361
  37. package/stubs/service/s3.stub +377 -377
  38. package/stubs/service/sentry.stub +76 -106
  39. package/stubs/service/stripe.stub +526 -526
  40. package/stubs/service/twilio.stub +361 -361
  41. package/core-stubs/app/R2Manager.php +0 -130
@@ -1,10 +1,12 @@
1
1
  <?php
2
2
 
3
+ namespace Src\Service;
4
+
3
5
  /**
4
6
  * Sentry Error Tracking Configuration
5
7
  *
6
8
  * Initializes the Sentry SDK for error reporting and provides
7
- * helper functions for capturing exceptions and messages.
9
+ * static helper functions for capturing exceptions and messages.
8
10
  *
9
11
  * Required ENV variables:
10
12
  * SENTRY_DSN — Sentry Data Source Name (project DSN from sentry.io)
@@ -14,126 +16,94 @@
14
16
  * APP_VERSION — Application version string, used as Sentry release tag
15
17
  *
16
18
  * Usage:
17
- * require_once __DIR__ . '/sentry.php';
19
+ * // Boot evresinde başlat:
20
+ * \Src\Service\Sentry::init();
18
21
  *
19
- * // Capture an exception
22
+ * // Hata yakalama:
20
23
  * try { ... } catch (\Throwable $e) {
21
- * $eventId = captureError($e);
24
+ * \Src\Service\Sentry::captureError($e);
22
25
  * }
23
26
  *
24
- * // Capture an informational message
25
- * captureMessage('Deployment completed', 'info');
27
+ * // Bilgi mesajı yakalama:
28
+ * \Src\Service\Sentry::captureMessage('Deployment completed', 'info');
26
29
  */
27
-
28
- // ---------------------------------------------------------------
29
- // Guard — only initialize when a DSN is available
30
- // ---------------------------------------------------------------
31
- if (empty($_ENV['SENTRY_DSN'])) {
30
+ class Sentry
31
+ {
32
32
  /**
33
- * No-op fallback when Sentry is not configured.
34
- *
35
- * @param \Throwable $e The exception (ignored).
36
- * @return string|null Always returns null.
33
+ * Sentry SDK'sını ortam değişkenlerine göre başlatır.
34
+ * Uygulamanın en başında (örneğin ViewControl.php veya ApiControl.php) çağrılmalıdır.
37
35
  */
38
- function captureError(\Throwable $e): ?string
36
+ public static function init(): void
39
37
  {
40
- return null;
38
+ if (empty($_ENV['SENTRY_DSN'])) {
39
+ return;
40
+ }
41
+
42
+ $isProduction = ($_ENV['APP_ENV'] ?? '0') === '0';
43
+ $environment = $isProduction ? 'production' : 'development';
44
+ $sampleRate = $isProduction ? 1.0 : 0.0;
45
+
46
+ $options = [
47
+ 'dsn' => $_ENV['SENTRY_DSN'],
48
+ 'environment' => $environment,
49
+ 'sample_rate' => $sampleRate,
50
+ ];
51
+
52
+ if (!empty($_ENV['APP_VERSION'])) {
53
+ $options['release'] = $_ENV['APP_VERSION'];
54
+ }
55
+
56
+ \Sentry\init($options);
41
57
  }
42
58
 
43
59
  /**
44
- * No-op fallback when Sentry is not configured.
60
+ * Yakalanan bir Exception veya Throwable nesnesini Sentry'e gönderir.
45
61
  *
46
- * @param string $message The message (ignored).
47
- * @param string $level Severity level (ignored).
48
- * @return string|null Always returns null.
62
+ * @param \Throwable $e Rapordanacak hata nesnesi.
63
+ * @return string|null Sentry event ID, veya başarısız olursa null.
49
64
  */
50
- function captureMessage(string $message, string $level = 'info'): ?string
65
+ public static function captureError(\Throwable $e): ?string
51
66
  {
52
- return null;
67
+ if (empty($_ENV['SENTRY_DSN'])) {
68
+ return null;
69
+ }
70
+
71
+ try {
72
+ $eventId = \Sentry\captureException($e);
73
+ return $eventId ? (string) $eventId : null;
74
+ } catch (\Throwable $inner) {
75
+ error_log('[Sentry::captureError] Failed to report: ' . $inner->getMessage());
76
+ return null;
77
+ }
53
78
  }
54
79
 
55
- return;
56
- }
57
-
58
- // ---------------------------------------------------------------
59
- // Determine environment & sample rate
60
- // ---------------------------------------------------------------
61
-
62
- /** @var bool Whether the application is running in production mode */
63
- $isProduction = ($_ENV['APP_ENV'] ?? '0') === '0';
64
-
65
- /** @var string Human-readable environment name for Sentry */
66
- $environment = $isProduction ? 'production' : 'development';
67
-
68
- /**
69
- * Sample rate:
70
- * 1.0 — capture 100 % of events in production
71
- * 0.0 — capture nothing in development (use captureError/captureMessage explicitly)
72
- */
73
- $sampleRate = $isProduction ? 1.0 : 0.0;
74
-
75
- // ---------------------------------------------------------------
76
- // Sentry initialization
77
- // ---------------------------------------------------------------
78
-
79
- $options = [
80
- 'dsn' => $_ENV['SENTRY_DSN'],
81
- 'environment' => $environment,
82
- 'sample_rate' => $sampleRate,
83
- ];
84
-
85
- // Attach release version when available
86
- if (!empty($_ENV['APP_VERSION'])) {
87
- $options['release'] = $_ENV['APP_VERSION'];
88
- }
89
-
90
- \Sentry\init($options);
91
-
92
- // ---------------------------------------------------------------
93
- // Helper functions
94
- // ---------------------------------------------------------------
95
-
96
- /**
97
- * Capture a Throwable and send it to Sentry.
98
- *
99
- * @param \Throwable $e The exception or error to report.
100
- * @return string|null The Sentry event ID, or null on failure.
101
- */
102
- function captureError(\Throwable $e): ?string
103
- {
104
- try {
105
- $eventId = \Sentry\captureException($e);
106
- return $eventId ? (string) $eventId : null;
107
- } catch (\Throwable $inner) {
108
- error_log('[Sentry::captureError] Failed to report: ' . $inner->getMessage());
109
- return null;
110
- }
111
- }
112
-
113
- /**
114
- * Capture a plain-text message and send it to Sentry.
115
- *
116
- * Supported severity levels: fatal, error, warning, info, debug.
117
- *
118
- * @param string $message Human-readable message to log.
119
- * @param string $level Sentry severity level (default: info).
120
- * @return string|null The Sentry event ID, or null on failure.
121
- */
122
- function captureMessage(string $message, string $level = 'info'): ?string
123
- {
124
- try {
125
- $severity = match ($level) {
126
- 'fatal' => \Sentry\Severity::fatal(),
127
- 'error' => \Sentry\Severity::error(),
128
- 'warning' => \Sentry\Severity::warning(),
129
- 'debug' => \Sentry\Severity::debug(),
130
- default => \Sentry\Severity::info(),
131
- };
132
-
133
- $eventId = \Sentry\captureMessage($message, $severity);
134
- return $eventId ? (string) $eventId : null;
135
- } catch (\Throwable $inner) {
136
- error_log('[Sentry::captureMessage] Failed to report: ' . $inner->getMessage());
137
- return null;
80
+ /**
81
+ * Belirtilen bir metni bilgi/uyarı mesajı olarak Sentry'e gönderir.
82
+ *
83
+ * @param string $message Gönderilecek metin.
84
+ * @param string $level Önem derecesi: fatal, error, warning, info, debug (Varsayılan: info).
85
+ * @return string|null Sentry event ID, veya başarısız olursa null.
86
+ */
87
+ public static function captureMessage(string $message, string $level = 'info'): ?string
88
+ {
89
+ if (empty($_ENV['SENTRY_DSN'])) {
90
+ return null;
91
+ }
92
+
93
+ try {
94
+ $severity = match ($level) {
95
+ 'fatal' => \Sentry\Severity::fatal(),
96
+ 'error' => \Sentry\Severity::error(),
97
+ 'warning' => \Sentry\Severity::warning(),
98
+ 'debug' => \Sentry\Severity::debug(),
99
+ default => \Sentry\Severity::info(),
100
+ };
101
+
102
+ $eventId = \Sentry\captureMessage($message, $severity);
103
+ return $eventId ? (string) $eventId : null;
104
+ } catch (\Throwable $inner) {
105
+ error_log('[Sentry::captureMessage] Failed to report: ' . $inner->getMessage());
106
+ return null;
107
+ }
138
108
  }
139
109
  }