artiframe make:class
artiframe make:class komutu, herhangi bir dizinde yeni bir PHP sınıfı oluşturur.
Dosya yolundan namespace'i otomatik hesaplar ve stub'ı doldurarak hazır bir sınıf iskeleti üretir.
Eğer standart dizinlerin (app/, src/) dışına bir sınıf eklenirse, Composer autoload haritasını da otomatik yeniler.
Kullanım
$ artiframe make:class [dizin/SinifAdi]
Zorunlu Kural: Hedef yolun en az bir dizin (slash) içermesi gerekir. Yalnızca dosya adı verilirse komut hata verir.
make:class PaymentService → ❌make:class src/Service/PaymentService → ✅
Örnekler
# src/Service altında bir servis sınıfı
$ artiframe make:class src/Service/PaymentService
# app/ dizininde özel bir sınıf
$ artiframe make:class app/Helpers/CurrencyHelper
# Tamamen özel bir dizin (Composer autoload otomatik yenilenir)
$ artiframe make:class lib/Integrations/SlackNotifier
Oluşturulan Dosya
artiframe make:class src/Service/PaymentService çalıştırıldığında:
| Değer | |
|---|---|
| Dosya yolu | src/Service/PaymentService.php |
| Namespace (otomatik) | Src\Service |
| Sınıf adı (otomatik) | PaymentService |
Oluşturulan dosya içeriği:
<?php
namespace Src\Service;
class PaymentService
{
public function __construct()
{
//
}
}
Composer Autoload Yenileme
Hedef dizin app/ veya src/ ile başlamıyorsa (özel bir root dizin), sistem arka planda otomatik olarak
composer dump-autoload -q komutunu çalıştırır. Bu sayede yeni sınıf, manuel bir adım gerektirmeksizin projenin autoloader haritasına anında eklenir.