Laravel 6 Get Config Variable Example – PHP

Rate this post

Today, We want to share with you Laravel 6 Get Config Variable Example.In this post we will show you laravel custom env variables, hear for laravel set env variable in controller we will give you demo and example for implement.In this post, we will learn about laravel get env variable in controller with an example.

Laravel 6 Get Config Variable Example

There are the Following The simple About Laravel: How to access config/Mail variables Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to access variable from config file in laravel 6, so the class ‘app\http\controllers\config’ not found is used for this example is following below.

Read Also:  PHP prepend leading zero prefixes after number

how to access variable from config file in laravel 6

under /config/app.php

@foreach (Config::get('app.languages') as $lang => $language)

get and set config

Laravel get and set config variables value example

Get Config Variable Value:

$domain = config('app.domain');


$domain = Config::get('app.domain');

Set Config Variable Value:

$domain = config('app.domain','');

$domain = Config::set('app.domain','');

using Route

Route::get('/test', function () {
    return "it is".config('');

Accessing Laravel .env variables in blade

@if (env('APP_ENV')!='Production')
	Your Code / App Is Enviroment Test

Free Live Chat for Any Issue

How to access Config variables in laravel 6?

// or 

Web Programming Tutorials Example with Demo

Read :

Read Also:  Laravel Define Global constants Config variables value


You can also read about AngularJS, ASP.NET, VueJs, PHP.


I hope you get an idea about laravel get env variable in blade.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.