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 Translatable Laravel Package

s-shiryaev/laravel-translatable

A Laravel package for adding translatable attributes to Eloquent models, storing translations as JSON and letting you read or set values per locale through a simple trait.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install the package via Composer and confirm your app runs Laravel 10 and PHP 8.1+ (Laravel 10’s minimum). If you’re upgrading from a 1.x line, treat 2.0.0 as a major release and read the upgrade guide before running composer update.
  • Publish any package configuration and migrations:
    php artisan vendor:publish --provider="Vendor\Package\ServiceProvider"
    php artisan migrate
    
  • Look first at the package’s README, UPGRADE.md, and config/ file. The config file is usually the fastest way to understand the package’s surface area and defaults.
  • A typical first use case: resolve the package’s main service from the container (or via its facade) in a controller, command, or job, and exercise a single feature end-to-end in a local environment before wiring it into production code.

Implementation Patterns

  • Dependency injection over facades where practical. Inject the package’s contracts or service classes into controllers, jobs, and commands. This keeps your code testable and makes it easier to swap implementations or mock behaviour.
  • Configuration-driven workflows. Most Laravel packages expose behaviour through config/package.php. Prefer environment variables for deployment-specific values, and keep package defaults in the published config file under version control.
  • Events and listeners. Check whether the package dispatches events (e.g. before/after actions). Listening to these is often the cleanest extension point for logging, notifications, or side effects without modifying vendor code.
  • Queues and jobs. If the package performs slow operations, look for built-in queue support or wrap calls in your own jobs. Ensure workers are restarted after deployment (php artisan queue:restart) so new package code is loaded.
  • Testing. Use Laravel’s container to bind fakes or mocks for the package’s services. For integration tests, use RefreshDatabase and assert against the package’s public API rather than internal classes.
  • Upgrade path for 2.0.0. Since this is a major version with Laravel 10 support, audit your composer.json constraints, run the test suite on a branch, and verify that any custom integrations (custom drivers, event listeners, extended classes) still conform to the 2.0 API.

Gotchas and Tips

  • Major version breaking changes. A 2.0.0 release that adds Laravel 10 support often drops support for older Laravel versions and may remove deprecated methods. Check composer.json for the required laravel/framework and php constraints, and review the changelog for removed or renamed classes.
  • Config caching. After publishing or changing package config, run php artisan config:clear (or config:cache in production) to avoid stale values.
  • Service provider registration. Laravel 10 uses package discovery, but if you’ve disabled it, register the provider manually in config/app.php. Double-check that the provider is not registered twice.
  • Environment parity. Laravel 10 requires PHP 8.1+. Ensure CI, local, and production environments match; otherwise you may see confusing dependency resolution errors.
  • Debugging. Use php artisan about to confirm Laravel version and environment. For container resolution issues, app()->make() exceptions usually point to missing bindings or config. Enable query logging or the package’s debug mode (if available) to trace behaviour.
  • Extension points. Prefer the package’s documented extension points (custom drivers, macros, events) over subclassing vendor classes. If you must override, bind your implementation in a service provider rather than editing vendor files.
  • Composer conflicts. If another package blocks the upgrade, use composer why-not vendor/package 2.0.0 to identify the constraint. Consider whether that dependency also needs a Laravel 10-compatible release.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings