@artilingo/artiframe-cli 1.4.0 → 2.0.1
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 +4347 -4390
- package/core-stubs/docs/en.html +4347 -4389
- package/core-stubs/docs/es.html +4347 -4390
- package/core-stubs/docs/fr.html +4347 -4389
- package/core-stubs/docs/tr.html +138 -109
- package/package.json +1 -1
- package/src/App.php +8 -0
- package/src/Commands/AddCommand.php +1 -1
- 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/TableCommand.php +2 -1
- package/src/Commands/UpgradeCommand.php +209 -0
- package/src/Commands/VersionCommand.php +2 -1
- package/src/Lang/de.php +7 -1
- package/src/Lang/en.php +6 -0
- package/src/Lang/es.php +7 -1
- package/src/Lang/fr.php +6 -0
- package/src/Lang/tr.php +7 -1
- 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,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
|
-
*
|
|
19
|
+
* // Boot evresinde başlat:
|
|
20
|
+
* \Src\Service\Sentry::init();
|
|
18
21
|
*
|
|
19
|
-
* //
|
|
22
|
+
* // Hata yakalama:
|
|
20
23
|
* try { ... } catch (\Throwable $e) {
|
|
21
|
-
*
|
|
24
|
+
* \Src\Service\Sentry::captureError($e);
|
|
22
25
|
* }
|
|
23
26
|
*
|
|
24
|
-
* //
|
|
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
|
-
*
|
|
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
|
|
36
|
+
public static function init(): void
|
|
39
37
|
{
|
|
40
|
-
|
|
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
|
-
*
|
|
60
|
+
* Yakalanan bir Exception veya Throwable nesnesini Sentry'e gönderir.
|
|
45
61
|
*
|
|
46
|
-
* @param
|
|
47
|
-
* @
|
|
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
|
|
65
|
+
public static function captureError(\Throwable $e): ?string
|
|
51
66
|
{
|
|
52
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
$
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
}
|