artisan make:class & make:enum
Scaffold plain PHP classes and enums with Artisan — stop creating boilerplate files manually.
Overview
Since Laravel 11, php artisan make:class and php artisan make:enum generate plain PHP files with proper namespace, boilerplate, and file placement. No more manually creating classes or copying templates.
Usage
Create a plain PHP class:
php artisan make:class Services/PaymentGateway
Generates app/Services/PaymentGateway.php:
<?php
namespace App\Services;
class PaymentGateway
{
//
}
Create an enum:
php artisan make:enum Enums/OrderStatus
Generates app/Enums/OrderStatus.php:
<?php
namespace App\Enums;
enum OrderStatus
{
//
}
For a backed enum, add the --string or --int flag:
php artisan make:enum Enums/OrderStatus --string
enum OrderStatus: string
{
//
}
Other Hidden make: Commands
Laravel has several lesser-known scaffolding commands:
php artisan make:interface Contracts/Payable
php artisan make:trait Concerns/HasSlug
List all available generators:
php artisan list make
When to Use
- Creating service classes, DTOs, or value objects
- Generating enums for status fields, types, or categories
- Any time you'd manually create a class file — let Artisan handle the namespace and directory