@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,130 +0,0 @@
|
|
|
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 App;
|
|
16
|
-
|
|
17
|
-
use Aws\S3\S3Client;
|
|
18
|
-
use Aws\Exception\AwsException;
|
|
19
|
-
|
|
20
|
-
class R2Manager
|
|
21
|
-
{
|
|
22
|
-
private S3Client $client;
|
|
23
|
-
private string $bucketName;
|
|
24
|
-
|
|
25
|
-
public function __construct()
|
|
26
|
-
{
|
|
27
|
-
$accountId = $_ENV['R2_ACCOUNT_ID'] ?? '';
|
|
28
|
-
$accessKey = $_ENV['R2_ACCESS_KEY'] ?? '';
|
|
29
|
-
$secretKey = $_ENV['R2_SECRET_KEY'] ?? '';
|
|
30
|
-
$this->bucketName = $_ENV['R2_BUCKET_NAME'] ?? '';
|
|
31
|
-
|
|
32
|
-
$this->client = new S3Client([
|
|
33
|
-
'version' => 'latest',
|
|
34
|
-
'region' => 'auto',
|
|
35
|
-
'endpoint' => "https://{$accountId}.r2.cloudflarestorage.com",
|
|
36
|
-
'credentials' => [
|
|
37
|
-
'key' => $accessKey,
|
|
38
|
-
'secret' => $secretKey,
|
|
39
|
-
],
|
|
40
|
-
// R2 için gerekli olabiliyor
|
|
41
|
-
'use_path_style_endpoint' => true,
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* R2 bucket'a dosya yükler.
|
|
47
|
-
*
|
|
48
|
-
* @param string $sourcePath Yerel dosya yolu (veya tmp_name)
|
|
49
|
-
* @param string $destinationKey Hedef R2 path/isim
|
|
50
|
-
* @param string $contentType MIME tipi
|
|
51
|
-
* @return string|false Yükleme başarılıysa dosyanın R2 adresi döner, aksi halde false.
|
|
52
|
-
*/
|
|
53
|
-
public function upload(string $sourcePath, string $destinationKey, string $contentType = 'application/octet-stream')
|
|
54
|
-
{
|
|
55
|
-
try {
|
|
56
|
-
$result = $this->client->putObject([
|
|
57
|
-
'Bucket' => $this->bucketName,
|
|
58
|
-
'Key' => $destinationKey,
|
|
59
|
-
'SourceFile' => $sourcePath,
|
|
60
|
-
'ContentType' => $contentType,
|
|
61
|
-
// Public okuma yetkisi vermek gerekirse ACL eklenebilir, ancak R2 genelde bucket policy kullanır.
|
|
62
|
-
// 'ACL' => 'public-read',
|
|
63
|
-
]);
|
|
64
|
-
|
|
65
|
-
// Cloudflare public dev.url veya bucket url döndürür. Projeye göre public URL yapılandırılır.
|
|
66
|
-
// Örnek public bucket path (Eğer R2'ye özel domain bağlıysa onu dönebilirsiniz)
|
|
67
|
-
// https://pub-xxxxxx.r2.dev/destinationKey gibi
|
|
68
|
-
return $destinationKey;
|
|
69
|
-
} catch (AwsException $e) {
|
|
70
|
-
error_log("R2 Yükleme Hatası: " . $e->getMessage());
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Base64 string'i bucket'a kaydeder.
|
|
77
|
-
*
|
|
78
|
-
* @param string $base64String
|
|
79
|
-
* @param string $destinationKey
|
|
80
|
-
* @param string $contentType
|
|
81
|
-
* @return string|false
|
|
82
|
-
*/
|
|
83
|
-
public function uploadBase64(string $base64String, string $destinationKey, string $contentType = 'image/jpeg')
|
|
84
|
-
{
|
|
85
|
-
// Data URI şeması varsa temizle (data:image/png;base64,...)
|
|
86
|
-
if (strpos($base64String, ',') !== false) {
|
|
87
|
-
$parts = explode(',', $base64String);
|
|
88
|
-
$base64String = $parts[1];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
$decodedData = base64_decode($base64String);
|
|
92
|
-
if ($decodedData === false) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
$result = $this->client->putObject([
|
|
98
|
-
'Bucket' => $this->bucketName,
|
|
99
|
-
'Key' => $destinationKey,
|
|
100
|
-
'Body' => $decodedData,
|
|
101
|
-
'ContentType' => $contentType,
|
|
102
|
-
]);
|
|
103
|
-
|
|
104
|
-
return $destinationKey;
|
|
105
|
-
} catch (AwsException $e) {
|
|
106
|
-
error_log("R2 Yükleme Hatası: " . $e->getMessage());
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* R2 bucket'tan dosya siler.
|
|
113
|
-
*
|
|
114
|
-
* @param string $key Silinecek dosyanın yolu/anahtarı (örn: avatars/123.jpg)
|
|
115
|
-
* @return bool Başarılıysa true, değilse false
|
|
116
|
-
*/
|
|
117
|
-
public function delete(string $key)
|
|
118
|
-
{
|
|
119
|
-
try {
|
|
120
|
-
$this->client->deleteObject([
|
|
121
|
-
'Bucket' => $this->bucketName,
|
|
122
|
-
'Key' => $key,
|
|
123
|
-
]);
|
|
124
|
-
return true;
|
|
125
|
-
} catch (AwsException $e) {
|
|
126
|
-
error_log("R2 Silme Hatası: " . $e->getMessage());
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|