artiframe make:class

The artiframe make:class command generates a new PHP class in any directory. It automatically calculates the namespace from the file path and generates a ready-to-use class skeleton by filling out the stub. If a class is added outside the standard directories (app/, src/), it also automatically refreshes the Composer autoload map.

Usage

$ artiframe make:class [directory/ClassName]
Mandatory Rule: The target path must contain at least one directory (slash). If only the filename is provided, the command will throw an error.
make:class PaymentService → ❌
make:class src/Service/PaymentService → ✅

Examples

# A service class under src/Service
$ artiframe make:class src/Service/PaymentService

# A custom class in the app/ directory
$ artiframe make:class app/Helpers/CurrencyHelper

# A completely custom directory (Composer autoload refreshes automatically)
$ artiframe make:class lib/Integrations/SlackNotifier

Generated File

When you run artiframe make:class src/Service/PaymentService:

Value
File pathsrc/Service/PaymentService.php
Namespace (auto)Src\Service
Class name (auto)PaymentService

Generated file content:

<?php

namespace Src\Service;

class PaymentService
{
    public function __construct()
    {
        //
    }
}

Composer Autoload Refresh

If the target directory does not start with app/ or src/ (a custom root directory), the system automatically runs the composer dump-autoload -q command in the background. This ensures that the new class is instantly added to the project's autoloader map without requiring any manual steps.