-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
Use Env::get instead of env #745
Conversation
It conflicts with other `env()` global functions (such as CakePHP), and most of them don't handle closures.
This was hell of a debug run. I resolved it by requiring Laravel helpers (why global!) before composer autoload. |
@oytuntez thanks for your pr, I’ll create a new release soon. |
Please note this broke Laravel <6 support as the |
@JaZo sorry about that! @mcamara I created another PR for version check. It duplicated a bunch of lines... It was a quick edit on GitHub UI 🤕 |
@oytuntez I actually don't understand why the global |
@iwasherefirst2 right, I actually resolved this issue by requiring Laravel's helper functions file earlier than CakePHP's (used in There was a back and forth with CakePHP and Laravel repos about this global namespace issue; anyone using phinx in Laravel ecosystem is affected by this. |
but by the time I started loading helpers earlier, I had already opened the PR and merged, so I had to follow up with another PR to fix my previous compatibility error. |
Even though I came here because my Laravel 5.8 project broke because of this, I support replacement of
|
@tontonsb It is a Laravel function and it is certainly recommended to use it :) The part that you quotet just mentioned that you shouldshould only call env in your configurations files, and in your application you should call |
@iwasherefirst2 that's what @tontonsb meant, I think. It is used in a risky way as it is. I have another PR pending, let's merge that and resolve the pain for L<6 users. |
@oytuntez its not risky. Its recommended to use it in the official docs. Its also recommended to not use it outside of config files to allow caching and improve application performance. Nothing wrong with env() wrapper and its used for Laravel 4,5,6,7,8 so we are all good :) |
Can confirm, it's broken on Laravel 5.7. Also, as previously noted, please consider not using https://laravel.com/docs/8.x/configuration#configuration-caching |
It conflicts with other
env()
global functions (such as CakePHP), and most of them don't handle closures.