Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Make Trait

Laravel Make Trait Laravel Package

mtownsend/laravel-make-trait

Adds a make:trait Artisan command to Laravel, letting you scaffold PHP traits from the CLI just like make:model or make:controller. Generates a clean trait stub in the right namespace automatically, saving boilerplate and keeping reusable trait files consistent across your project.

View on GitHub
Deep Wiki
Context7

Rapid trait generation in Laravel

Frequently asked questions about Laravel Make Trait
How do I install mtownsend/laravel-make-trait in a Laravel application?
Install it with Composer, ideally as a development-only dependency: composer require --dev mtownsend/laravel-make-trait. In a standard Laravel app, package discovery should register the service provider automatically, so no manual wiring or configuration is required. After installation, the make:trait Artisan command becomes available in your CLI and can be run like make:model or make:controller.
Which Laravel and PHP versions does laravel-make-trait support?
The last release was in February 2023, so its Composer constraints may not explicitly declare support for newer Laravel majors or PHP versions. Before adopting it, check the illuminate/support and illuminate/console constraints in the package's composer.json against your project baseline. If the constraints block your current Laravel version, the command is small enough to copy internally rather than waiting on an upstream update.
Does laravel-make-trait register its command automatically through Laravel package discovery?
Yes, this is a standard Laravel package that is expected to auto-register via package discovery after composer require --dev, with no service provider wiring needed in config/app.php. Confirm discovery in your target environment, especially if you use a customized skeleton or a non-standard bootstrap. Running php artisan list and looking for make:trait is the quickest verification step.
Where does make:trait put generated trait files, and what namespace do they use?
The package generates a clean trait stub in the appropriate namespace automatically, following your project's PSR-4 layout and default app namespace. Generated files are plain PHP traits, so they remain usable even if you later remove the dependency. Run the command in a scratch branch first and compare the output path and namespace against your team conventions.
Is laravel-make-trait safe to use in production?
It is a developer-productivity tool, not a runtime dependency, so it should live in require-dev and never ship in your production dependency graph. The package is tiny, MIT-licensed, and isolated to Artisan scaffolding, so it does not affect request handling, persistence, or queues. The real risk is lifecycle-related: a stale, low-adoption dependency can become a Composer constraint blocker during framework upgrades.
Can make:trait generate traits in subdirectories or use custom stubs and namespaces?
The documented surface is a simple make:trait command that scaffolds a trait in the correct namespace, and the README does not promise subdirectory, custom-stub, or per-project namespace options. Test any behavior you rely on in a disposable branch before standardizing it across the team. If you need custom stubs or directory targeting, an internal Artisan command gives you full control.
What should I do if laravel-make-trait blocks a Laravel upgrade?
Because the functionality is a thin wrapper around Artisan generator patterns, the escape hatch is strong: fork the package, vendor the command class, or reimplement it as a local command in app/Console/Commands. Generated traits are plain PHP and remain untouched by removal, so dropping the dependency is low risk. Pin a known-good version, document the fallback, and recheck constraints during each Laravel upgrade cycle.
How does laravel-make-trait compare to writing my own Artisan trait command?
The package saves you the one-time boilerplate of writing a generator command and gives you a familiar make:trait interface immediately. Against that, it has very low adoption, a single maintainer, and no updates since early 2023, so the long-term value versus a small internal command is limited. Teams with strict dependency governance often prefer a short in-house command they fully own.
Is laravel-make-trait still maintained, and what are the alternatives?
Release history suggests limited activity, with the last release in February 2023, only around 14 stars, and zero dependents, so treat it as community-supported with no vendor SLA. Alternatives include a small internal Artisan command, a private package for your organization's scaffolding conventions, or simply copying the generated trait pattern manually. For enterprise use, assign an internal owner or vendor the command to remove upstream risk.
How do I test or remove laravel-make-trait without breaking existing traits?
Run the generator in a non-production branch or CI job, confirm traits land in the expected namespace and path, and check that the command does not conflict with existing make:* commands. Removal is equally simple: drop the require-dev dependency and keep any generated traits, since they are ordinary PHP classes. Add a note in developer onboarding so new team members know whether the command is available or replaced internally.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections