Weave Code
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

Config Laravel Package

laravel-lang/config

Language configuration companion for the Laravel Lang ecosystem. Provides shared config resources used across Laravel Lang packages, with Composer installation and MIT licensing. Includes contribution guidelines and ways to support the project.

View on GitHub
Deep Wiki
Context7
## Product Decisions This Supports
- **Globalization & Localization Strategy**: Enables dynamic, language/region-specific configurations (e.g., API endpoints, feature flags, UI strings) without hardcoding. Critical for scaling multilingual SaaS platforms, regional compliance (e.g., GDPR, tax laws), or localized user experiences (e.g., date formats, payment gateways).
  - *Example*: Serve `config('services.stripe.endpoint.eu')` for EU users automatically.
- **Build vs. Buy Decision**: Eliminates the need to build a custom configuration localization system, saving **3–6 months of development time** while leveraging Laravel’s ecosystem. Ideal for teams prioritizing **velocity** and **maintainability**.
- **Key Use Cases**:
  - **Multilingual SaaS**: Localize configs for regions (e.g., `config('legal.terms.es')` for Spain).
  - **Progressive Web Apps (PWAs)**: Dynamically load language-specific feature toggles or UI themes (e.g., `config('ui.theme.dark_mode')`).
  - **Legacy Modernization**: Gradually introduce localization to monolithic apps by migrating configs incrementally.
  - **A/B Testing**: Route users to language-specific configurations (e.g., `config('experiment.cta_button.fr')`) without code changes.
  - **Compliance**: Enforce region-specific configs (e.g., `config('privacy.policy.gdpr')`).
- **Cost Optimization**: Reduces translation tooling costs by centralizing locale-aware configs in PHP files (e.g., `config/locales/en.php`), avoiding duplication in databases or external services.
- **Developer Experience**: Integrates seamlessly with Laravel’s existing `config()` helper, requiring minimal learning curve.

---

## When to Consider This Package
### **Adopt If**:
- Your Laravel app requires **language/region-specific configurations** (e.g., `config/app.php` values that vary by locale, region, or user segment).
- You need **automatic fallback chains** for configs (e.g., `es_MX` → `es` → `en`) without manual merging logic.
- Your team lacks bandwidth to build a **custom localization layer** for configs (e.g., nested arrays, dynamic loading).
- You’re using **Laravel 8+** and want to avoid reinventing the wheel for config localization.
- Your configs are **file-based** (not database-driven) and require **runtime flexibility** (e.g., per-request overrides).
- You need to **support 10+ locales** without manual config duplication.
- Your product requires **dynamic theming** or **feature flags** tied to user language/region.

### **Look Elsewhere If**:
- You need **database-driven configs**: This package is file-based; consider **Spatie’s `laravel-config-array`** or a CMS integration (e.g., Strapi, Contentful) for dynamic updates.
- Your configs are **static** (no language/region variation): Use Laravel’s built-in `config()` helper.
- You’re using **non-Laravel PHP** (e.g., Symfony, Lumen without Laravel’s core): Evaluate framework-native solutions (e.g., Symfony’s `ParameterBag`).
- You require **real-time config updates**: File-based systems need cache invalidation (e.g., `config:clear`). For live updates, pair with **Redis** or a **config service** (e.g., LaunchDarkly, Unleash).
- Your team needs **advanced validation** for configs: This package focuses on localization; combine with **VentureCraft’s `reverb`** or **Spatie’s `laravel-validation-rules`** for schema validation.
- You’re on **Laravel < 8**: The package drops support for older versions (e.g., Laravel 10 is unsupported in v2.x).
- Your configs are **highly sensitive** (e.g., secrets): Avoid storing them in PHP files; use environment variables or a secrets manager.

---

## How to Pitch It (Stakeholders)

### **For Executives (Business/Strategy)**
*"This package lets us ship localized configurations—like region-specific APIs, legal disclaimers, or UI elements—**without custom development**, accelerating our [Q3 international expansion] by **40%**. For example:
- **Spanish users** automatically see `config('services.payment.gateway.es')` for localized payment processing.
- **EU compliance** is enforced via `config('privacy.gdpr.enabled')` without manual checks.
- **A/B testing** for language-specific CTAs (e.g., `config('ui.cta_button.fr')`) reduces dev overhead.

**Why It’s a No-Brainer**:
- **MIT License**: No vendor lock-in; maintained by the Laravel community.
- **Cost Savings**: Eliminates the need for custom tooling or translation service integrations.
- **Scalability**: Supports **100+ locales** with zero additional infrastructure.
- **Speed**: Cuts localization setup time from **months to days**.

**Ask**: Should we prioritize this for [Product X]’s global launch to reduce risk and cost?"

---

### **For Engineering (Technical)**
*"The `laravel-lang/config` package provides a **zero-boilerplate** way to manage language-specific configs using Laravel’s existing `config()` helper. Here’s the breakdown:

**Key Features**:
- **Automatic Fallbacks**: Load configs like `config('app.locale_aware_setting')` with chains (e.g., `es_MX` → `es` → `default`).
- **File-Based**: No database overhead; edits trigger cache rebuilds (`config:clear`).
- **Laravel-Native**: Integrates with service providers, facades, and caching.
- **Testable**: Mock configs in PHPUnit without touching files.
- **Future-Proof**: Works with Laravel’s upcoming localization improvements.

**Integration Steps**:
1. Publish configs:
   ```bash
   php artisan vendor:publish --provider="LaravelLangConfigServiceProvider"
  1. Bind the package in config/app.php:
    'providers' => [
        LaravelLangConfigServiceProvider::class,
    ],
    
  2. Use configs with fallbacks:
    $endpoint = config('services.stripe.endpoint'); // Falls back to default
    

Tradeoffs:

  • File-Based Only: Not real-time (use Redis for live updates).
  • Cache Dependency: Requires config:clear after updates (or automate with Git hooks).
  • Limited Validation: Focuses on localization; pair with reverb for schema validation.

Alternatives:

Solution Pros Cons Fit for laravel-lang/config
Custom Solution Full control High maintenance cost ❌ No
Spatie’s laravel-translation Great for models Not for configs ❌ No
Symfony’s ParameterBag Robust Overkill for Laravel ❌ No
Database-Driven Real-time updates Complex setup ❌ No (unless paired with Redis)

Risk Mitigation:

  • Test fallback behavior with edge cases (missing locales).
  • Benchmark cache performance for high-traffic apps (e.g., 10K+ RPS).
  • Use environment variables for sensitive configs (e.g., APP_LOCALE)."

For Design/UX (Localization)

*"This package enables dynamic, language-specific UI elements without hardcoding, giving us flexibility for:

  • Localized Strings: Serve config('ui.cta_button.es') = '¡Compra Ahora!' automatically.
  • Dynamic Themes: Load configs like config('ui.theme.colors.dark_mode') for locale-aware styling.
  • A/B Testing: Test language-specific designs (e.g., config('ui.layout.es')) without code changes.

Workflow:

  1. Designers update config/locales/es/ui.php.
  2. Devs run config:clear (or automate with Git hooks).
  3. App serves localized configs automatically.

Example:

// config/locales/en/ui.php
'cta_button' => 'Buy Now',

// config/locales/es/ui.php
'cta_button' => '¡Compra Ahora!',

// In Blade:
<button>{{ config('ui.cta_button') }}</button>

Tools to Pair With:

  • Laravel Lang Manager: For translation files (e.g., .json).
  • Sentry: Monitor config-related errors in production.
  • Laravel Mix: Precompile locale-specific assets (e.g., CSS variables)."

For DevOps/SRE

*"This package adds no infrastructure overhead but requires:

  • Cache Management:
    • Use config:clear after config file updates (or automate with Git hooks).
    • For CI/CD, add to deployment scripts:
      php artisan config:clear
      
  • Environment Awareness:
    • Ensure APP_LOCALE is set in .env (e.g., APP_LOCALE=es_MX).
    • Use .env.local for environment-specific configs.
  • Backup Strategy:
    • Version-control config files (e.g., Git LFS for large files).
    • Exclude `bootstrap/cache/config.php
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.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui