jornatf/laravel-trait-generator

A Laravel Package to make Trait with artisan CLI.

v1.0.0 2023-04-23 22:17 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel Package to make Trait with artisan CLI.

If you like this package you can Buy me a Coffee ☕️

Installation

Via composer:

composer require jornatf/laravel-trait-generator

Usage

Via artisan CLI:

php artisan make:trait Foo

The trait namespace is: App\Traits.

Trait generated:

<?php

namespace App\Traits;

trait Foo
{
    /**
     * Method description.
     *
     * @return string
     */
    public function methodName()
    {
        return "Hello World";
    }
}

Import trait:

<?php

namespace App\Http\Controllers;

use App\Traits\Foo;
use App\Http\Controllers\Controller;

class PostController extends Controller
{
    use Foo;

    // your controller methods HERE.
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Feel free to contribute to this project to improve with new features or fix bugs 👍

Credits

License

The MIT License (MIT).

Please see License File for more information.