Skip to content

[Feature]: Ignore missing env variables #206

Open
@Catlike14

Description

@Catlike14

Feature Description

Sometimes, I run a job worker by passing environment variables directly through the command line, for example:

MY_VAR=123 php artisan queue:work

In the job, I retrieve the variable using env('MY_VAR'). However, the extension flags this with a warning that the environment variable does not exist in the .env file. While this is generally accurate, in this specific case, the variable is expected to be provided via the command line and is intentionally absent from the .env file.

It would be helpful to have a way to suppress this warning for such cases. For example, something like this:

class MyJob implements ShouldQueue {
    public function handle() {
        // laravel-extension disable-next-line no-missing-env
        $myVar = env('MY_VAR');
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions