rukhsar/traitcommand

A laravel artisan command to generate trait quickly.

Maintainers

Package info

github.com/Rukhsar/laravel-traitcommand

pkg:composer/rukhsar/traitcommand

Statistics

Installs: 507

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.1 2016-11-29 22:16 UTC

This package is not auto-updated.

Last update: 2026-03-01 03:58:44 UTC


README

A laravel artisan command to generate trait quickly.

Install

Via Composer

composer require rukhsar/traitcommand

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

Rukhsar\TraitCommand\TraitCommandServiceProvider::class,

Usage

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 is the name of the trait, and the second is the name of the folder you want it to reside in. If the folder does not exist, it will be created for you. If you leave second argument empty, trait will be created under app/

For example:

php artisan make:trait ModelTrait Traits

This would create a directory named Traits in your app directory with a php file named ModelTrait.php.