Skip to content

Improve .env error feedback for unquoted values with spaces (e.g. APP_NAME = My App)Β #588

@meke16

Description

@meke16

Hi πŸ‘‹,

I ran into an issue while working on a Laravel project that might be confusing for beginners.

I changed my .env file like this:

APP_NAME = tinat app

Immediately after saving, my app crashed completely β€” no error message, blank page, and even php artisan stopped working.

Because I have some experience, I quickly realized the problem was that the value contained a space without quotes.
After changing it to:

APP_NAME=tinat-app

everything worked fine again.

However, for beginners, this kind of situation is really confusing. The app just crashes with no feedback, so they have no idea what went wrong or how to fix it.

πŸ’‘ Suggestion

It would be helpful if Laravel or vlucas/phpdotenv showed a clear, beginner-friendly error message when parsing .env files with unquoted values that contain spaces.

For example:

⚠️ Invalid .env format: wrap values with spaces in quotes (e.g. APP_NAME="My App")

This would make the developer experience smoother and prevent unnecessary frustration for new users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions