@artilingo/artiframe-cli 1.2.1 → 1.3.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.
@@ -312,19 +312,31 @@ class SystemMethod
312
312
  }
313
313
 
314
314
  /**
315
- * Converts a raw 16-byte binary UUID into its standard string representation.
316
- * (e.g. 0190ed84-3f12-7a91-8bc4-91823741abcd)
317
- *
318
- * @param string $binaryUuid 16-byte binary string
319
- * @return string 36-character hyphenated UUID string
315
+ * Bi-directional UUID formatter (String <-> Binary)
316
+ *
317
+ * @param string $value 16-byte binary string OR 36-character UUID string
318
+ * @param string $to 'auto', 'binary', or 'string'
319
+ * @return string
320
320
  */
321
- public static function formatId(string $binaryUuid): string
321
+ public static function formatId(string $value, string $to = 'auto'): string
322
322
  {
323
- if (strlen($binaryUuid) !== 16) {
323
+ // Target: Binary conversion (String -> Binary)
324
+ if ($to === 'binary' || ($to === 'auto' && strlen($value) !== 16)) {
325
+ $cleanHex = str_replace('-', '', $value);
326
+
327
+ if (strlen($cleanHex) !== 32) {
328
+ throw new \InvalidArgumentException("Invalid UUID string format.");
329
+ }
330
+
331
+ return hex2bin($cleanHex);
332
+ }
333
+
334
+ // Target: String conversion (Binary -> String)
335
+ if (strlen($value) !== 16) {
324
336
  throw new \InvalidArgumentException("Invalid binary UUID length. Expected 16 bytes.");
325
337
  }
326
338
 
327
- $hex = bin2hex($binaryUuid);
339
+ $hex = bin2hex($value);
328
340
 
329
341
  return sprintf(
330
342
  '%s-%s-%s-%s-%s',
@@ -378,6 +390,72 @@ class SystemMethod
378
390
  return $asString ? (string) $result : $result;
379
391
  }
380
392
 
393
+ /**
394
+ * Sadece sayılardan oluşan rastgele bir OTP (One-Time Password) kodu üretir.
395
+ * @param int $length Hanelerin sayısı (Varsayılan 6)
396
+ */
397
+ public static function otpInt(int $length = 6): int
398
+ {
399
+ if ($length < 1) $length = 1;
400
+ if ($length > 18) $length = 18; // PHP 64-bit safe max length
401
+
402
+ $min = (int) str_pad('1', $length, '0');
403
+ $max = (int) str_pad('9', $length, '9');
404
+
405
+ return random_int($min, $max);
406
+ }
407
+
408
+ /**
409
+ * Sadece harflerden oluşan rastgele bir OTP kodu üretir.
410
+ * @param int $length Hanelerin sayısı (Varsayılan 6)
411
+ * @param string $case 'c': Sadece küçük, 'C': Sadece büyük, 'cC'/'Cc': Karışık
412
+ */
413
+ public static function otpStr(int $length = 6, string $case = 'C'): string
414
+ {
415
+ $lower = 'abcdefghijklmnopqrstuvwxyz';
416
+ $upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
417
+
418
+ $chars = match (strtolower($case)) {
419
+ 'c' => $lower,
420
+ 'cc' => $lower . $upper,
421
+ default => $upper,
422
+ };
423
+
424
+ $otp = '';
425
+ $maxIndex = strlen($chars) - 1;
426
+ for ($i = 0; $i < $length; $i++) {
427
+ $otp .= $chars[random_int(0, $maxIndex)];
428
+ }
429
+
430
+ return $otp;
431
+ }
432
+
433
+ /**
434
+ * Harf ve sayılardan (Alphanumeric) oluşan rastgele bir OTP kodu üretir.
435
+ * @param int $length Hanelerin sayısı (Varsayılan 6)
436
+ * @param string $case 'c': Küçük+Sayı, 'C': Büyük+Sayı, 'cC'/'Cc': Karışık+Sayı
437
+ */
438
+ public static function otpMix(int $length = 6, string $case = 'C'): string
439
+ {
440
+ $numbers = '0123456789';
441
+ $lower = 'abcdefghijklmnopqrstuvwxyz';
442
+ $upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
443
+
444
+ $chars = match (strtolower($case)) {
445
+ 'c' => $numbers . $lower,
446
+ 'cc' => $numbers . $lower . $upper,
447
+ default => $numbers . $upper,
448
+ };
449
+
450
+ $otp = '';
451
+ $maxIndex = strlen($chars) - 1;
452
+ for ($i = 0; $i < $length; $i++) {
453
+ $otp .= $chars[random_int(0, $maxIndex)];
454
+ }
455
+
456
+ return $otp;
457
+ }
458
+
381
459
  /**
382
460
  * Gelen veriyi (özellikle BigInt ID'leri) güvenli bir şekilde string'e çevirir.
383
461
  * Javascript'te 15 haneyi aşan sayılardaki veri kaybını engellemek için
@@ -517,8 +595,8 @@ if (!function_exists(__NAMESPACE__ . '\\byteId')) {
517
595
  }
518
596
 
519
597
  if (!function_exists(__NAMESPACE__ . '\\formatId')) {
520
- function formatId(string $binaryUuid): string {
521
- return \Bin\SystemMethod::formatId($binaryUuid);
598
+ function formatId(string $value, string $to = 'auto'): string {
599
+ return \Bin\SystemMethod::formatId($value, $to);
522
600
  }
523
601
  }
524
602
 
@@ -545,3 +623,21 @@ if (!function_exists(__NAMESPACE__ . '\\stringer')) {
545
623
  return \Bin\SystemMethod::stringer($value);
546
624
  }
547
625
  }
626
+
627
+ if (!function_exists(__NAMESPACE__ . '\\otpInt')) {
628
+ function otpInt(int $length = 6): int {
629
+ return \Bin\SystemMethod::otpInt($length);
630
+ }
631
+ }
632
+
633
+ if (!function_exists(__NAMESPACE__ . '\\otpStr')) {
634
+ function otpStr(int $length = 6, string $case = 'C'): string {
635
+ return \Bin\SystemMethod::otpStr($length, $case);
636
+ }
637
+ }
638
+
639
+ if (!function_exists(__NAMESPACE__ . '\\otpMix')) {
640
+ function otpMix(int $length = 6, string $case = 'C'): string {
641
+ return \Bin\SystemMethod::otpMix($length, $case);
642
+ }
643
+ }
@@ -345,6 +345,16 @@ class ViewMethod
345
345
  $masked = $start . str_repeat('*', max($len - 5, 3)) . $end;
346
346
  return self::display($masked);
347
347
  }
348
+
349
+ /**
350
+ * Veritabanından gelen 16 byte'lık binary UUID verisini 36 karakterlik
351
+ * okunabilir (HEX) formata dönüştürür ve ekrana basar.
352
+ */
353
+ public static function uuid(?string $binaryId): string
354
+ {
355
+ if (empty($binaryId)) return '-';
356
+ return self::display(\Bin\SystemMethod::formatId($binaryId));
357
+ }
348
358
  }
349
359
 
350
360
  // Geliştiriciler (Özellikle Juniorlar) için kullanımı en kolay global yardımcı fonksiyonlar
@@ -461,3 +471,9 @@ if (!function_exists(__NAMESPACE__ . '\\maskPhone')) {
461
471
  return \Bin\ViewMethod::maskPhone($phone);
462
472
  }
463
473
  }
474
+
475
+ if (!function_exists(__NAMESPACE__ . '\\uuid')) {
476
+ function uuid(?string $binaryId): string {
477
+ return \Bin\ViewMethod::uuid($binaryId);
478
+ }
479
+ }
@@ -275,7 +275,8 @@
275
275
  <a href="#cli-new">new</a>
276
276
  <a href="#cli-view">make:view</a>
277
277
  <a href="#cli-api">make:api</a>
278
- <a href="#cli-class">make:class</a>
278
+ <a href="#cli-class">make:class</a>
279
+ <a href="#cli-table">table:</a>
279
280
  <a href="#cli-cliv">cli v</a>
280
281
  <a href="#cli-show">show</a>
281
282
  <a href="#cli-list">list</a>
@@ -308,7 +309,8 @@
308
309
  <a href="#vh-maskemail">maskEmail()</a>
309
310
  <a href="#vh-maskphone">maskPhone()</a>
310
311
  <a href="#vh-slugify">slugify()</a>
311
- <a href="#vh-money">money()</a>
312
+ <a href="#vh-money">money()</a>
313
+ <a href="#vh-uuid">uuid()</a>
312
314
  <div class="sb-cat">Systemhelfer</div>
313
315
  <div class="sb-subcat">Antwort und Fehlerbehebung</div>
314
316
  <a href="#sh-apiresponse">apiResponse()</a>
@@ -344,7 +346,8 @@
344
346
  <a href="#sh-formatid">formatId()</a>
345
347
  <a href="#sh-intid">intId()</a>
346
348
  <a href="#sh-bigintid">bigintId()</a>
347
- <a href="#sh-stringer">stringer()</a>
349
+ <a href="#sh-stringer">stringer()</a>
350
+ <a href="#sh-otpcoder">OTP Coder</a>
348
351
  <div class="sb-cat">API-Sicherheit</div>
349
352
  <a href="#api-methods">HTTP-Methodensteuerung</a>
350
353
  <a href="#api-cors">CORS</a>
@@ -454,7 +457,15 @@
454
457
  btn.style.border = 'none';
455
458
  }
456
459
  </script>
457
- </section>
460
+
461
+ <h3 style="margin-top: 30px;">Zusätzliche Befehle</h3>
462
+ <p><strong>Tabellen auflisten:</strong> Um alle verfügbaren Tabellenvorlagen und ihre Beschreibungen anzuzeigen:</p>
463
+ <pre><code>artiframe&gt; <span class="fn">table</span> <span class="st">list</span></code></pre>
464
+
465
+ <p><strong>Tabelleninhalt in der Vorschau anzeigen:</strong> Um den SQL-Inhalt im Terminal zu überprüfen, bevor Sie ihn zur <code>schema.sql</code>-Datei hinzufügen, können Sie den <code>check</code> Parameter anhängen:</p>
466
+ <pre><code>artiframe&gt; <span class="fn">table:</span><span class="st">users</span> <span class="st">check</span></code></pre>
467
+
468
+ </section>
458
469
  <!-- ====== KURULUM ====== -->
459
470
  <section id="kurulum">
460
471
  <h2>Aufstellen</h2>
@@ -762,7 +773,100 @@ Projektname/
762
773
  ❌ Hata: Sınıfın oluşturulacağı dizin belirtilmeli! (örn: /app veya /src)
763
774
  Example: /src/Service/PaymentService</code></pre>
764
775
  </section>
765
- <!-- cli v -->
776
+
777
+ <!-- table: -->
778
+ <section id="cli-table">
779
+ <h2><code>table:</code> <span class="tag b-cli">CLI-Befehl</span></h2>
780
+ <p>Ermöglicht das schnelle Anhängen von standardmäßigen und relationalen Datenbanktabellen an die <code>schema.sql</code>-Datei Ihres Projekts. Die Vorlagen werden aus der globalen Datei <code>stubs/sql.stub</code> gelesen.</p>
781
+ <pre><code>artiframe&gt; <span class="fn">table:</span><span class="st">users</span></code></pre>
782
+ <p>Derzeit unterstützte Standardtabellen:</p>
783
+ <div class="table-tabs-container" style="margin-top: 20px;">
784
+ <div class="tabs-header" style="display: flex; gap: 10px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 5px;">
785
+ <button class="table-tab-btn active" onclick="switchTableTab('tab-users', this)" style="white-space: nowrap; padding: 10px 20px; background: #00c88c; color: #000; font-weight: 600; border: none; border-radius: 5px; cursor: pointer;">users</button>
786
+ <button class="table-tab-btn" onclick="switchTableTab('tab-sessions', this)" style="white-space: nowrap; padding: 10px 20px; background: #1c2128; color: #fff; border: 1px solid #30363d; border-radius: 5px; cursor: pointer;">user_sessions</button>
787
+ <button class="table-tab-btn" onclick="switchTableTab('tab-prefs', this)" style="white-space: nowrap; padding: 10px 20px; background: #1c2128; color: #fff; border: 1px solid #30363d; border-radius: 5px; cursor: pointer;">user_preferences</button>
788
+ </div>
789
+
790
+ <!-- Tab: users -->
791
+ <div id="tab-users" class="table-tab-content" style="display: block;">
792
+ <pre><code><span class="kw">CREATE TABLE `users` (
793
+ `id` binary(16) NOT NULL,
794
+ `email` varchar(255) NOT NULL,
795
+ `password` varchar(255) NOT NULL,
796
+ `name` varchar(255) DEFAULT NULL,
797
+ `role` enum('user','admin','moderator') NOT NULL DEFAULT 'user',
798
+ `status` tinyint(1) NOT NULL DEFAULT '1',
799
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
800
+ `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
801
+ PRIMARY KEY (`id`),
802
+ UNIQUE KEY `email` (`email`)
803
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;</span></code></pre>
804
+ </div>
805
+
806
+ <!-- Tab: user_sessions -->
807
+ <div id="tab-sessions" class="table-tab-content" style="display: none;">
808
+ <pre><code><span class="kw">CREATE TABLE `user_sessions` (
809
+ `id` binary(16) NOT NULL,
810
+ `user_id` binary(16) NOT NULL,
811
+ `token` varchar(255) NOT NULL,
812
+ `ip_address` varchar(45) DEFAULT NULL,
813
+ `user_agent` varchar(255) DEFAULT NULL,
814
+ `expires_at` timestamp NULL DEFAULT NULL,
815
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
816
+ PRIMARY KEY (`id`),
817
+ UNIQUE KEY `token` (`token`),
818
+ KEY `user_id` (`user_id`),
819
+ CONSTRAINT `fk_user_sessions_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
820
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;</span></code></pre>
821
+ </div>
822
+
823
+ <!-- Tab: user_preferences -->
824
+ <div id="tab-prefs" class="table-tab-content" style="display: none;">
825
+ <pre><code><span class="kw">CREATE TABLE `user_preferences` (
826
+ `id` binary(16) NOT NULL,
827
+ `user_id` binary(16) NOT NULL,
828
+ `language` varchar(10) NOT NULL DEFAULT 'tr',
829
+ `theme` varchar(20) NOT NULL DEFAULT 'light',
830
+ `push_notifications` tinyint(1) NOT NULL DEFAULT '1',
831
+ `email_notifications` tinyint(1) NOT NULL DEFAULT '1',
832
+ `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
833
+ `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
834
+ PRIMARY KEY (`id`),
835
+ UNIQUE KEY `user_id` (`user_id`),
836
+ CONSTRAINT `fk_user_prefs_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
837
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;</span></code></pre>
838
+ </div>
839
+ </div>
840
+
841
+ <script>
842
+ function switchTableTab(tabId, btn) {
843
+ const container = btn.closest('.table-tabs-container');
844
+ container.querySelectorAll('.table-tab-content').forEach(el => el.style.display = 'none');
845
+ container.querySelectorAll('.table-tab-btn').forEach(el => {
846
+ el.style.background = '#1c2128';
847
+ el.style.color = '#fff';
848
+ el.style.border = '1px solid #30363d';
849
+ el.style.fontWeight = '400';
850
+ });
851
+
852
+ container.querySelector('#' + tabId).style.display = 'block';
853
+ btn.style.background = '#00c88c';
854
+ btn.style.color = '#000';
855
+ btn.style.fontWeight = '600';
856
+ btn.style.border = 'none';
857
+ }
858
+ </script>
859
+
860
+ <h3 style="margin-top: 30px;">Zusätzliche Befehle</h3>
861
+ <p><strong>Tabellen auflisten:</strong> Um alle verfügbaren Tabellenvorlagen und ihre Beschreibungen anzuzeigen:</p>
862
+ <pre><code>artiframe&gt; <span class="fn">table</span> <span class="st">list</span></code></pre>
863
+
864
+ <p><strong>Tabelleninhalt in der Vorschau anzeigen:</strong> Um den SQL-Inhalt im Terminal zu überprüfen, bevor Sie ihn zur <code>schema.sql</code>-Datei hinzufügen, können Sie den <code>check</code> Parameter anhängen:</p>
865
+ <pre><code>artiframe&gt; <span class="fn">table:</span><span class="st">users</span> <span class="st">check</span></code></pre>
866
+
867
+ </section>
868
+
869
+ <!-- cli v -->
766
870
  <section id="cli-cliv">
767
871
  <h2><code>cli v</code> (oder <code>cli version</code>) <span class="tag b-cli">CLI Komutu</span></h2>
768
872
  <p>ArtiFrame CLI steuert seine eigene (globale) Version des Tools. Zeigt nicht nur die aktuelle Version, <strong>NPM-Registrierung</strong> Außerdem wird geprüft, ob die aktuellste Version verfügbar ist. Wenn es eine neue Version gibt, kann diese sich mit einem Klick global aktualisieren (j/n).<code>npm install -g @artilingo/artiframe-cli@latest</code>).</p>
@@ -3981,7 +4085,15 @@ if ($response['status'] === 'success') {
3981
4085
 
3982
4086
  &lt;span&gt;&lt;?= <span class="fn">money</span>(<span class="var">$urun</span>[<span class="st">'fiyat'</span>], <span class="st">'usd'</span>) ?&gt;&lt;/span&gt;
3983
4087
  <span class="cm">&lt;!-- Çıktı: $1.250,00 --&gt;</span></code></pre>
3984
- </section>
4088
+ </section>
4089
+
4090
+ <section id="vh-uuid">
4091
+ <h2>View Helpers - <code>uuid()</code> <span class="tag b-view">ViewMethod</span></h2>
4092
+ <p>Konvertiert eine binäre 16-Byte-UUID aus der Datenbank in ein 36-Zeichen-Format und druckt sie mit XSS-Schutz auf den Bildschirm.</p>
4093
+ <pre><code><span class="cm">&lt;!-- Ausgabe: 0190ed84-3f12-7a91-8bc4-91823741abcd --&gt;</span>
4094
+ &lt;div&gt;<span class="kw">&lt;?=</span> <span class="fn">uuid</span>(<span class="var">$pull</span>[<span class="st">'id'</span>]) <span class="kw">?&gt;</span>&lt;/div&gt;</code></pre>
4095
+ </section>
4096
+
3985
4097
  <!-- ====== SYSTEM HELPERS ====== -->
3986
4098
  <section id="sh-apiresponse">
3987
4099
  <h2>Systemhelfer— <code>apiResponse()</code> <span class="tag b-api">SystemMethod</span></h2>
@@ -4024,7 +4136,29 @@ if ($response['status'] === 'success') {
4024
4136
  <span class="cm">// Hata yanıtı</span>
4025
4137
  <span class="fn">jsonResponse</span>([<span class="st">'status'</span> =&gt; <span class="st">'error'</span>, <span class="st">'message'</span> =&gt; <span class="st">'Yetkisiz erişim.'</span>], <span class="nu">401</span>);</code></pre>
4026
4138
  </section>
4027
- <section id="sh-generatecsrf">
4139
+
4140
+ <section id="sh-dd">
4141
+ <h2>Systemhelfer— <code>dd()</code> <span class="tag b-api">SystemMethod</span></h2>
4142
+ <p>Dump &amp; Die. Während der Entwicklungsphase wurden die Variablen im dunklen Modus, lesbar und stilvoll auf dem Bildschirm angezeigt. <code>&lt;pre&gt;</code> Tag und stoppt die Ausführung des Codes in dieser Zeile (Exit). Es können unbegrenzte Parameter angenommen werden (Variadic).</p>
4143
+ <span class="ret">void dd(mixed ...$vars)</span>
4144
+ <pre><code><span class="fn">dd</span>(<span class="var">$_POST</span>, <span class="var">$kullanici_id</span>);
4145
+ <span class="cm">// Değerleri ekrana basar ve sistemi durdurur.</span></code></pre>
4146
+ </section>
4147
+ <!-- ====== ID GENERATION & UTILITIES ====== -->
4148
+ <section id="id-generation-utilities">
4149
+ </section>
4150
+
4151
+
4152
+ <section id="sh-redirect">
4153
+ <h2>Systemhelfer— <code>redirect()</code> <span class="tag b-api">SystemMethod</span></h2>
4154
+ <span class="ret">void redirect(string $url)</span>
4155
+ <p>zur gewünschten Seite <code>header("Location: ...")</code> Es leitet sofort um und funktioniert nicht mehr mit (<code>exit</code>).</p>
4156
+ <pre><code><span class="kw">if</span> (!<span class="var">$isLoggedIn</span>) {
4157
+ <span class="fn">redirect</span>(<span class="st">'/login'</span>);
4158
+ }</code></pre>
4159
+ </section>
4160
+
4161
+ <section id="sh-generatecsrf">
4028
4162
  <h2>Systemhelfer— <code>generateCsrf()</code> <span class="tag b-api">SystemMethod</span></h2>
4029
4163
  <p>Es generiert ein brandneues sitzungsbasiertes sicheres CSRF-Token mit einer Länge von 32 Bytes. Zum Hinzufügen als versteckte Eingabe zu Formularen <code>csrfField()</code> Es wird empfohlen, (View Helper) zu verwenden.</p>
4030
4164
  <span class="ret">string generateCsrf()</span>
@@ -4110,14 +4244,7 @@ if ($response['status'] === 'success') {
4110
4244
  <p>Erkennt die tatsächliche IP-Adresse des Benutzers. Wolkenflare (<code>HTTP_CF_CONNECTING_IP</code>), Proxy (<code>HTTP_X_FORWARDED_FOR</code>) und Standard (<code>REMOTE_ADDR</code>) löst alle Verbindungen automatisch auf.</p>
4111
4245
  <pre><code><span class="var">$ip</span> = <span class="fn">getClientIp</span>(); <span class="cm">// Örn: 192.168.1.1</span></code></pre>
4112
4246
  </section>
4113
- <section id="sh-redirect">
4114
- <h2>Systemhelfer— <code>redirect()</code> <span class="tag b-api">SystemMethod</span></h2>
4115
- <span class="ret">void redirect(string $url)</span>
4116
- <p>zur gewünschten Seite <code>header("Location: ...")</code> Es leitet sofort um und funktioniert nicht mehr mit (<code>exit</code>).</p>
4117
- <pre><code><span class="kw">if</span> (!<span class="var">$isLoggedIn</span>) {
4118
- <span class="fn">redirect</span>(<span class="st">'/login'</span>);
4119
- }</code></pre>
4120
- </section>
4247
+
4121
4248
  <section id="sh-verifyemail">
4122
4249
  <h2>Systemhelfer— <code>verifyEmail()</code> <span class="tag b-api">SystemMethod</span></h2>
4123
4250
  <p>Es überprüft anhand von DNS oder Format, ob die angegebene E-Mail-Adresse tatsächlich eine gültige E-Mail-Adresse ist.</p>
@@ -4159,16 +4286,10 @@ if ($response['status'] === 'success') {
4159
4286
  <pre><code><span class="var">$postData</span> = <span class="fn">arrayOnly</span>(<span class="var">$_POST</span>, [<span class="st">'kullanici_adi'</span>, <span class="st">'sifre'</span>, <span class="st">'email'</span>]);
4160
4287
  <span class="cm">// ID, rol gibi dışarıdan manipüle edilmiş değerler otomatik yok edilir.</span></code></pre>
4161
4288
  </section>
4162
- <section id="sh-dd">
4163
- <h2>Systemhelfer— <code>dd()</code> <span class="tag b-api">SystemMethod</span></h2>
4164
- <p>Dump &amp; Die. Während der Entwicklungsphase wurden die Variablen im dunklen Modus, lesbar und stilvoll auf dem Bildschirm angezeigt. <code>&lt;pre&gt;</code> Tag und stoppt die Ausführung des Codes in dieser Zeile (Exit). Es können unbegrenzte Parameter angenommen werden (Variadic).</p>
4165
- <span class="ret">void dd(mixed ...$vars)</span>
4166
- <pre><code><span class="fn">dd</span>(<span class="var">$_POST</span>, <span class="var">$kullanici_id</span>);
4167
- <span class="cm">// Değerleri ekrana basar ve sistemi durdurur.</span></code></pre>
4168
- </section>
4169
- <!-- ====== ID GENERATION & UTILITIES ====== -->
4170
- <section id="id-generation-utilities">
4171
- <h2 id="sh-byteid">Systemhelfer - <code>byteId()</code> <span class="tag b-api">SystemMethod</span></h2>
4289
+
4290
+
4291
+ <section id="sh-byteid">
4292
+ <h2>Systemhelfer - <code>byteId()</code> <span class="tag b-api">SystemMethod</span></h2>
4172
4293
  <div class="info-box">
4173
4294
  Native, leistungsstarke und zeitlich geordnete 16-Byte-Rohdaten <strong>UUIDv7</strong> produziert.
4174
4295
  </div>
@@ -4184,7 +4305,10 @@ if ($response['status'] === 'success') {
4184
4305
 
4185
4306
  <span class="var">$db</span>-&gt;<span class="fn">prepare</span>(<span class="st">"INSERT INTO users (id, name) VALUES (?, ?)"</span>)-&gt;<span class="fn">execute</span>([<span class="var">$rawId</span>, <span class="st">'Utku'</span>]);</code></pre>
4186
4307
  </div>
4187
- <h2 id="sh-makeid">Systemhelfer - <code>makeId()</code> <span class="tag b-api">SystemMethod</span></h2>
4308
+ </section>
4309
+
4310
+ <section id="sh-makeid">
4311
+ <h2>Systemhelfer - <code>makeId()</code> <span class="tag b-api">SystemMethod</span></h2>
4188
4312
  <div class="info-box">
4189
4313
  Nativ, Standard 36 Zeichen <strong>UUIDv7</strong> erzeugt die Zeichenfolge.
4190
4314
  </div>
@@ -4198,7 +4322,10 @@ if ($response['status'] === 'success') {
4198
4322
  <span class="var">$stringId</span> = SystemMethod::<span class="fn">makeId</span>();
4199
4323
  <span class="cm">// Örnek Çıktı: 0190ed84-3f12-7a91-8bc4-91823741abcd</span></code></pre>
4200
4324
  </div>
4201
- <h2 id="sh-formatid">Systemhelfer - <code>formatId()</code> <span class="tag b-api">SystemMethod</span></h2>
4325
+ </section>
4326
+
4327
+ <section id="sh-formatid">
4328
+ <h2>Systemhelfer - <code>formatId()</code> <span class="tag b-api">SystemMethod</span></h2>
4202
4329
  <div class="info-box">
4203
4330
  Konvertiert rohe 16-Byte-Binär-UUIDs in eine Standardzeichenfolge mit 36 ​​Zeichen.
4204
4331
  </div>
@@ -4213,7 +4340,10 @@ if ($response['status'] === 'success') {
4213
4340
  <span class="var">$readableId</span> = SystemMethod::<span class="fn">formatId</span>(<span class="var">$user</span>[<span class="st">'id'</span>]);
4214
4341
  <span class="cm">// Örnek Çıktı: 0190ed84-3f12-7a91-8bc4-91823741abcd</span></code></pre>
4215
4342
  </div>
4216
- <h2 id="sh-intid">Systemhelfer - <code>intId()</code> <span class="tag b-api">SystemMethod</span></h2>
4343
+ </section>
4344
+
4345
+ <section id="sh-intid">
4346
+ <h2>Systemhelfer - <code>intId()</code> <span class="tag b-api">SystemMethod</span></h2>
4217
4347
  <div class="info-box">
4218
4348
  Sicher, zufällig <code>INT</code> Erzeugt eine ID. (Max. 9 Ziffern)
4219
4349
  </div>
@@ -4225,7 +4355,10 @@ if ($response['status'] === 'success') {
4225
4355
  <pre><code><span class="var">$id</span> = <span class="fn">intId</span>(8);
4226
4356
  <span class="cm">// Örnek Çıktı: 49201834</span></code></pre>
4227
4357
  </div>
4228
- <h2 id="sh-bigintid">Systemhelfer - <code>bigintId()</code> <span class="tag b-api">SystemMethod</span></h2>
4358
+ </section>
4359
+
4360
+ <section id="sh-bigintid">
4361
+ <h2>Systemhelfer - <code>bigintId()</code> <span class="tag b-api">SystemMethod</span></h2>
4229
4362
  <div class="info-box">
4230
4363
  Sicher, zufällig <code>BIGINT</code> Erzeugt eine ID. (Standard 15 Ziffern – sichere Grenze für JS)
4231
4364
  </div>
@@ -4237,7 +4370,10 @@ if ($response['status'] === 'success') {
4237
4370
  <pre><code><span class="var">$id</span> = <span class="fn">bigintId</span>(); <span class="cm">// 15 haneli INT döner</span>
4238
4371
  <span class="var">$massiveId</span> = <span class="fn">bigintId</span>(18, <span class="kw">true</span>); <span class="cm">// 18 haneli STRING döner (JS için güvenli)</span></code></pre>
4239
4372
  </div>
4240
- <h2 id="sh-stringer">Systemhelfer - <code>stringer()</code> <span class="tag b-api">SystemMethod</span></h2>
4373
+ </section>
4374
+
4375
+ <section id="sh-stringer">
4376
+ <h2>Systemhelfer - <code>stringer()</code> <span class="tag b-api">SystemMethod</span></h2>
4241
4377
  <div class="info-box">
4242
4378
  Verpackt Werte in Zeichenfolgen, um sie vor der Unempfindlichkeit gegenüber riesigen Zahlen (BIGINT) von Javascript zu schützen.
4243
4379
  </div>
@@ -4249,7 +4385,25 @@ if ($response['status'] === 'success') {
4249
4385
  <pre><code><span class="cm">&lt;!-- JS'in bozmasını engellemek için stringer ile sarmalıyoruz --&gt;</span>
4250
4386
  &lt;button data-id=<span class="st">"&lt;?=</span> <span class="fn">stringer</span>(<span class="var">$data</span>[<span class="st">'id'</span>]) <span class="st">?&gt;"</span>&gt;Sil&lt;/button&gt;</code></pre>
4251
4387
  </div>
4252
- </section>
4388
+
4389
+
4390
+ <section id="sh-otpcoder">
4391
+ <h2>System Helpers - OTP Coder <span class="tag b-api">SystemMethod</span></h2>
4392
+ <div class="info-box">Generiert zufällige, kryptografisch sichere Einmalpasswörter (OTP).</div>
4393
+ <div class="code-block">
4394
+ <pre><code><span class="cm">// 6-stellige Zufallszahl</span>
4395
+ <span class="var">$code</span> = <span class="fn">otpInt</span>(<span class="nu">6</span>); <span class="cm">// 482910</span>
4396
+
4397
+ <span class="cm">// 8-stellige reine Buchstaben ('c': klein, 'C': groß, 'cC': gemischt)</span>
4398
+ <span class="var">$code</span> = <span class="fn">otpStr</span>(<span class="nu">8</span>, <span class="st">'C'</span>); <span class="cm">// PKLMDZRA</span>
4399
+
4400
+ <span class="cm">// 6-stellig alphanumerisch</span>
4401
+ <span class="var">$code</span> = <span class="fn">otpMix</span>(<span class="nu">6</span>, <span class="st">'C'</span>); <span class="cm">// 9A4X2Z</span></code></pre>
4402
+ </div>
4403
+ </section>
4404
+
4405
+
4406
+ </section>
4253
4407
  <!-- ====== API GÜVENLİĞİ ====== -->
4254
4408
  <section id="api-methods">
4255
4409
  <h2>API – HTTP-Methodensteuerung <span class="tag b-sec">ApiControl</span></h2>