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 Useful Additions Laravel Package

laracraft-tech/laravel-useful-additions

A handy set of practical Laravel additions that reduce boilerplate and simplify everyday development. With drop-in helpers and macros for common patterns, it keeps your code cleaner, more expressive, and easier to reuse across projects.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with Composer: composer require laracraft-tech/laravel-useful-additions. For Laravel 13 projects, require ^4.3 (the first release with Laravel 13 support).
  • There is usually no config file to publish; the package is trait-based. Start by scanning the README for the trait list and picking one concern you currently hand-roll.
  • First use case: add UUID primary keys and slugs to a model with minimal boilerplate.
use LaracraftTech\LaravelUsefulAdditions\Traits\HasUuid;
use LaracraftTech\LaravelUsefulAdditions\Traits\HasSlug;

class Post extends Model
{
    use HasUuid, HasSlug;
}

Migration:

$table->uuid('id')->primary();
$table->string('slug')->unique();

Implementation Patterns

  • Model traits: Apply traits per model. HasUuid / HasUlid handle primary-key generation on create; HasSlug generates slugs from a source column; HasJsonAttributes casts JSON columns to arrays; HasSortable supports ordered records; HasTags adds polymorphic tagging.
  • Compose traits carefully: A base model can carry shared traits, but avoid combining HasUuid and HasUlid on the same model. Keep slug and sortable traits on models that actually need those columns.
  • Slug workflow: Define the source column (e.g. title) per the README, then let the trait generate on creating. Add a unique index and handle collisions in application code if needed.
  • JSON attributes: Use HasJsonAttributes instead of manually casting JSON columns when you want array access and dirty tracking. Keep the database column type as json or text.
  • Sortable workflow: Use HasSortable for drag-and-drop ordering. Wrap reorder operations in transactions and index the order column.
  • Laravel 13 integration: v4.3.0 adds Laravel 13 support. If you are upgrading a Laravel 13 app, bump the package constraint to ^4.3; no breaking changes are called out in the release notes.

Gotchas and Tips

  • Compatibility: v4.3.0 is required for Laravel 13. Older versions will fail Composer resolution on Laravel 13. Check composer why-not laracraft-tech/laravel-useful-additions if installation fails.
  • Trait conflicts: Do not use HasUuid and HasUlid together. If a model already defines boot() or bootTraitName(), verify the trait boot methods still run.
  • Slug uniqueness: The package generates slugs, but uniqueness is your responsibility. Add a unique index and decide on collision strategy (suffix, UUID, or reject).
  • JSON casting conflicts: If you already use $casts for a JSON column, HasJsonAttributes may overlap. Pick one approach per attribute.
  • Sortable concurrency: Reordering can race under concurrent requests. Use transactions and consider a unique constraint on the order column per group.
  • Debugging: If a trait does not seem to fire, inspect the model’s booted/creating events and dump $model->getAttributes() after create(). Trait boot methods are easy to miss in large models.
  • Extension points: Override trait methods in the model when you need custom behavior (e.g. slug source logic). Check the README for any publishable config before overriding.
  • Upgrade path: Since v4.3.0 only adds Laravel 13 support and a dependency bump, routine composer update is low risk. Run your model/factory tests after upgrading to confirm trait behavior.
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.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast