@artilingo/artiframe-cli 2.0.4 → 2.0.5
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/LICENSE +660 -660
- package/bin/artiframe.js +0 -0
- package/bin/artiframe.php +0 -0
- package/core-stubs/app/ApiAuthControl.php +76 -0
- package/core-stubs/app/ApiControl.php +81 -35
- package/core-stubs/app/AuthControl.php +39 -0
- package/core-stubs/app/Database.php +36 -35
- package/core-stubs/app/DotEnv.php +19 -1
- package/core-stubs/app/ViewControl.php +47 -1
- package/core-stubs/bin/SQLMethod.php +261 -0
- package/core-stubs/bin/SystemMethod.php +115 -74
- package/core-stubs/bin/ViewMethod.php +19 -5
- package/core-stubs/docs/de.html +4325 -4347
- package/core-stubs/docs/en.html +4325 -4347
- package/core-stubs/docs/es.html +4325 -4347
- package/core-stubs/docs/fr.html +4325 -4347
- package/core-stubs/docs/tr.html +117 -46
- package/core-stubs/public/403.php +52 -0
- package/core-stubs/public/assets/css/components/header.css +174 -0
- package/core-stubs/public/assets/css/components/mobilenav.css +198 -0
- package/core-stubs/public/assets/css/components/sidebar.css +184 -0
- package/core-stubs/public/assets/css/root/app.css +975 -38
- package/core-stubs/public/assets/css/root/root.css +64 -0
- package/core-stubs/public/assets/js/components/header.js +380 -0
- package/core-stubs/public/assets/js/components/mobilenav.js +97 -0
- package/core-stubs/public/assets/js/components/theme-modal.js +74 -0
- package/core-stubs/public/assets/js/root/app.js +1870 -0
- package/core-stubs/public/includes/footer.php +4 -5
- package/core-stubs/public/includes/head-auth.php +65 -0
- package/core-stubs/public/includes/head.php +56 -17
- package/core-stubs/public/includes/header.php +135 -1
- package/core-stubs/public/includes/mobilenav.php +75 -3
- package/core-stubs/public/includes/sidebar.php +186 -1
- package/core-stubs/public/includes/theme-modal.php +1 -0
- package/db-studio/debug.log +3 -0
- package/db-studio/index.html +1755 -0
- package/db-studio/launcher.html +102 -0
- package/db-studio/launcher.js +180 -0
- package/db-studio/logo.svg +22 -0
- package/db-studio/main.js +568 -0
- package/db-studio/package-lock.json +1034 -0
- package/db-studio/package.json +16 -0
- package/db-studio/preload.js +29 -0
- package/devops-studio/api-inspector.js +222 -0
- package/devops-studio/index.html +1892 -0
- package/devops-studio/logo.svg +22 -0
- package/devops-studio/main.js +67 -0
- package/devops-studio/make-wizard.js +635 -0
- package/devops-studio/package-lock.json +871 -0
- package/devops-studio/package.json +12 -0
- package/package.json +5 -2
- package/scripts/postinstall.js +44 -8
- package/server-studio/.json-404-guard +1 -0
- package/server-studio/index.html +283 -0
- package/server-studio/logo.svg +22 -0
- package/server-studio/main.js +133 -0
- package/server-studio/package-lock.json +1179 -0
- package/server-studio/package.json +15 -0
- package/server-studio/router.php +99 -0
- package/src/App.php +29 -0
- package/src/Commands/AddCommand.php +26 -9
- package/src/Commands/DbExportCommand.php +131 -0
- package/src/Commands/DbStartCommand.php +46 -0
- package/src/Commands/DevopsCommand.php +35 -0
- package/src/Commands/GoCommand.php +48 -48
- package/src/Commands/ListCommand.php +68 -68
- package/src/Commands/MakeApiCommand.php +6 -1
- package/src/Commands/MakeViewCommand.php +25 -2
- package/src/Commands/NewProjectCommand.php +16 -11
- package/src/Commands/OptimizeCommand.php +61 -0
- package/src/Commands/RemoveCommand.php +35 -7
- package/src/Commands/ServeCommand.php +46 -91
- package/src/Commands/ShowCommand.php +24 -24
- package/src/Commands/UpgradeCommand.php +39 -10
- package/stubs/make/api-switch-case.stub +1 -1
- package/stubs/make/auth-api-standart.stub +20 -0
- package/stubs/make/auth-api-switch-case.stub +38 -0
- package/stubs/make/auth-view.stub +26 -0
- package/stubs/make/class.stub +10 -2
- package/stubs/make/view.stub +3 -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/stripe.stub +526 -526
- package/stubs/service/twilio.stub +361 -361
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
namespace Src\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
|
-
}
|
|
1
|
+
<?php
|
|
2
|
+
namespace Src\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
|
+
}
|