Artisan Command To Create A Trait Stub

1.0.7 2016-04-06 02:34 UTC

This package is not auto-updated.

Last update: 2022-06-25 15:49:54 UTC


Latest Version on Packagist Software License Total Downloads

TraitMaker creates an artisan command that lets you quickly create a trait folder and trait stub. If the folder already exists, you can use the command to place new traits in the exsiting folder.


Via Composer

composer require evercode1/trait-maker

In your app/config/app.php file, add the following to the providers array:



Once installed, you should see make:trait as one of the artisan commands when you run:

php artisan list

To use this command, supply it with two arguments, the first being the name of the trait, and the second being the name of the folder you want it to reside in. If the folder does not exist, it will be created for you.

For example:

php artisan make:trait SampleTrait TraitsFolder

This would create a directory named TraitsFolder in your app directory with a php file named SampleTrait.php, which would contain the following stub:

namespace App\TraitsFolder

trait SampleTrait


Please note, the package currently only supports trait folders that are in the app folder, for example:


It cannot be used to create the following location:


Change log

Please see CHANGELOG for more information what has changed recently.


Please see CONTRIBUTING and CONDUCT for details.


If you discover any security related issues, please email ikon321@yahoo.com instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.