Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add support for custom env reader functions #80

Open
hailwood opened this issue Jul 27, 2021 · 2 comments
Open

[Feature] Add support for custom env reader functions #80

hailwood opened this issue Jul 27, 2021 · 2 comments

Comments

@hailwood
Copy link

Right now the plugin works great with laravel using env('SOMETHING').

However I like to create a second helper for when the app just won't run without an environment variable defined.

function env_or_throw($key, $default = null)
{
    return env(
        $key, 
        $default ?? fn() => throw new \Exception("Missing require environment variable '{$key}'.")
    );
}

It would be great if we could specify that env_or_throw or my_special_env_function was an env alias.

@adelf
Copy link
Collaborator

adelf commented Jul 28, 2021

Hi. Good idea. I'll try to make a setting for that.

And you gave a great idea for a new feature for Laravel Idea plugin :) Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@hailwood @adelf and others