cp .env.example .env
php artisan key:generate
APP_ENV=local
APP_DEBUG=true
@env('local')
{{-- will only be rendered in the local environment --}}
<div class="space-y-2">
<x-login-link email="admin@spatie.be"/>
<x-login-link email="user@spatie.be"/>
</div>
@endenv
@production
// code here
@endproduction
// To encrypt a Laravel .env file
php artisan env:encrypt
// A new .env.encrypted will be created and the key will be printed
// In the output. This key should be saved in Password Manager to
// Decrypt it later.
// To decrypt a Laravel .env file
php artisan env:decrypt
<script>
var env_variable = '{{ env('VARIABLE') }}';
alert(env_variable);
</script>
@env('staging')
// The application is running in "staging"...
@endenv
@env(['staging', 'production'])
// The application is running in "staging" or "production"...
@endenv