Answers for "how to create .env file in laravel"

PHP
0

what is app_env in laravel

Laravel 5 uses .env file to configure your app. .env should not be committed on your repository, like github or bitbucket. On your local environment your .env will look like the following:

# .env
APP_ENV=local
For your production server, you might have the following config:

# .env
APP_ENV=production
Posted by: Guest on August-19-2020
0

laravel generate env

cp .env.example .env
php artisan key:generate
Posted by: Guest on October-06-2021
2

laravel get env variable

dd(env('APP_NAME'));
Posted by: Guest on October-15-2020
1

laravel set config

config()->set('config.path', $value);
Posted by: Guest on January-08-2021
1

laravel update env file programmatically

public static function envUpdate($key, $value)
    {
        $path = base_path('.env');

        if (file_exists($path)) {

            file_put_contents($path, str_replace(
                $key . '=' . env($key), $key . '=' . $value, file_get_contents($path)
            ));
        }
    }

And reload the page programatically again using js only once
<script>
  	window.location.reload();
</script>
Posted by: Guest on June-29-2020

Browse Popular Code Answers by Language