Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
neeno31464yJust kidding, of all those words I only understood war, crime and env. I don't know shit about php
-
Here's how the thing goes
In every Laravel's project there's a top level "config" folder.
That's pretty much what runs at the beginning of your application; here you are allowed to use env("somethingsomething") to get the values of your .env file.
You COULD theorically use .env in other files too, and so long as you are in development, it can work.
Thing is: accessing all those separate files is slow, you don't want that for production. Combining all those files into a single one may come in handy. That's what php artisan config:cache does for you.
Then, you can access those config values with the Illuminate\Support\Facades\Auth facade. If you follow these steps your applications should become faster, but of course you can't use .env anymore.
I have attached literal pics; do this thing, run "php artisan config:cache" and enjoy a better designed project.
EDIT: devrant butchered the quality on this one, I hope it's clear what's going on anyway.
Related Rants
If I see one more Laravel dev I'mma commit a war crime
If I see one more Laravel dev dropping env(something) around the code I'mma commit _SEVERAL_ war crimes
Remember kids: you don't work with Laravel. If you do (you don't, but let's assume), ENV IS USED ONLY IN CONFIGURATION FILES, OR LARAVEL CACHING SYSTEM FUCKING BREAKS. Ok?
rant
php
laravel