Laravel

Articles on Laravel architecture, packages, and production practices — how I structure configuration, model domains, and keep large applications maintainable, including deep dives into the packages I publish.

  • Your .env Files Aren't DRY. One Copy Will Drift.

    Most projects carry a set of values that are identical in every environment — a currency, a temperature, a rate limit — copied into every .env and every server. That duplication is the precondition for an environment-specific bug nobody intended to create. How to find those values, declare them once, and what it does to your review diffs and your CI pipeline.

    learning/laravel/dry-shared-values-across-environments

  • Spatie laravel-settings vs laravel-env-settings: Two Packages, Two Different Problems

    Both give you typed settings classes instead of stringly-typed config lookups, which makes them look like alternatives. They are not. One stores values in your database so they can change at runtime; the other stores them in version control so they can differ per environment. What each solves, where each fails, and how to decide.

    learning/laravel/spatie-settings-vs-env-settings

  • The One Thing Laravel's config() Cannot Tell You

    config() is the right tool for most of what you use it for — and there is one question it structurally cannot answer. Where the boundary falls, why 'never call env() outside config files' quietly creates the problem, and why Laravel's own stock keys never move even though most of them are not secret.

    learning/laravel/config-vs-typed-settings

  • 17 Reasons Your .env Is Doing Too Much

    The .env file was designed to hold secrets. Convention turned it into the place every configuration value goes, secret or not — and that habit costs you history, types, review and a working production deploy. Seventeen symptoms, one question that sorts every line, and where the boundary genuinely stays put.

    learning/laravel/env-file-doing-too-much

  • Enums in laravel-env-settings: Typo-Proof, Not Environment-Aware

    PHP enums turn an invalid configuration value into an error you cannot write. What they cannot do is know which environment they are running in. Where that line falls, why putting per-environment values inside an enum hides them from every tool you own, and how to combine the two properly.

    learning/laravel/enums-environment-aware-settings

  • PHP 8 Attributes in Practice: Moving Metadata Back onto the Code

    A short tour of how PHP 8 attributes actually work, an independent look at what problem they genuinely solve, and two worked case studies from adding #[Environment] and #[Sensitive] to a Laravel package — including the reflection gotchas that only show up once you ship it.

    learning/laravel/php-8-attributes-in-practice

  • laravel-env-settings: Typed, Environment-Aware Config Instead of a Bloated .env

    A complete walkthrough of my Laravel package that moves non-secret configuration out of .env and into typed PHP classes that resolve automatically from APP_ENV — the problem it solves, how resolution works, root settings composition, local overrides, the Artisan inspector commands, and how it changes developer onboarding.

    learning/laravel/laravel-env-settings