epigra/laravel-int
Epigra's Laravel Int package offers lightweight, integer-focused helpers and utilities for Laravel applications, making common tasks around integer values and model handling simpler and more consistent. It is easy to install and designed to fit smoothly into existing Laravel projects.
composer require epigra/laravel-int. Check the package's composer.json for extra.laravel.providers / aliases. If they're absent (common in smaller packages), register the service provider and facade manually in config/app.php before assuming anything works. This is the single most common first-run failure.php artisan vendor:publish --provider="Epigra\Int\IntServiceProvider" (confirm the exact provider FQCN from the repo) and read the generated config/int.php end to end. Treat that file as the package's real documentation — for a package with no dependents and no ecosystem, the config keys and the README are your only sources of truth.vendor/epigra/laravel-int (or open it in your IDE) and skim src/. Look for: what the service provider binds into the container, what the facade proxies, whether it hooks into Laravel's translator or reimplements it, and whether it registers middleware. Ten minutes here prevents a day of guesswork later.app.locale and app.fallback_locale, add a lang/{code} directory with two keys, add a /lang/{locale} route that writes to session and redirects back, and render {{ int('welcome.title') }} (or whatever the package's helper is) in a Blade view. Once that round-trips, you understand 80% of the package.Detection middleware. Put locale resolution in a single middleware ordered after StartSession and after auth if locale is user-scoped. Resolve in priority order: explicit request param → session → authenticated user's preference → Accept-Language negotiation → config('app.fallback_locale'). Write it once and never read locale anywhere else.
Route-level localization. Two viable shapes:
Route::group(['prefix' => '{locale}'], ...) with a whereIn constraint built from config('int.locales'). SEO-friendly, cache-friendly, but requires every route() call to pass the locale — consider a URL::defaults(['locale' => app()->getLocale()]) call in a middleware to avoid threading it through every view.Language switcher as a component. A Blade component or Livewire component that renders available locales from config and posts to a single controller action. On switch: persist to session (and user record if logged in), then redirect()->back() with the previous URL preserved — not redirect('/'), which loses the user's place.
Config over DB. Keep the locale list in config/int.php, not a languages table. Locale sets change on deploy, not at runtime; a DB table forces a query per request or a cache layer you'll forget to invalidate.
Fallback chain for content. For model-level translations (product names, categories), the pattern that ages best is a translations relation with locale + value columns and an accessor that tries app()->getLocale() then falls back. If the package provides such a trait, use it; if not, don't force the package into that role — Laravel's own HasTranslations-style accessor is easier to reason about.
Validation and auth messages. Point users at lang/{code}/validation.php and lang/{code}/auth.php early. Most "the package is broken" reports are actually untranslated framework strings leaking through in a non-English locale.
Testing. Use $this->withSession(['locale' => 'tr'])->get(...) for session flows, and app()->setLocale('tr') in unit tests. Assert on rendered strings, not on package internals, so a version bump doesn't break your suite.
config:cache and published config. If you publish config after running php artisan config:cache, your changes won't apply until you re-cache. This bites during initial setup constantly.StartSession sees no session and silently falls back to the default — the symptom looks like "session isn't saving" when it's actually ordering. Check app/Http/Kernel.php or bootstrap/app.php.{locale} constraints work under route:cache, but closures in route files do not. Convert switcher routes to controller actions before deploying behind a cache.PluralizationRules, keyed by locale. Turkish, Japanese, and Chinese have a single plural form; Arabic has six. If the package ships its own pluralizer, verify it against Laravel's before trusting it for these locales.LocaleResolver interface rather than calling its helpers directly from controllers and views. That way, if the package goes unmaintained (a real risk at this size), swapping it out is a one-file change.composer.json and add a smoke test that asserts your switcher round-trips — that test is your early-warning system for a breaking release.How can I help you explore Laravel packages today?