在Laravel 4应用程序配置期间使用Session类

Is it possible to access the Session class in my app/config/app.php file?

I am able to use use Illuminate\Support\Facades\Input; but not use Illuminate\Support\Facades\Session; (or Cookie for that matter) at this stage of the app request.

I think it may be a good way to store my debug toggle for my development environment. I will toggle debug via a GET variable and would like it to last throughout a session (or until I unset it), rather than until the next request which will not include the variable.

The contig files are loaded very early in the app's lifetime, I'm surprised even Input works. No, there is no way to use session variables in the config files themselves. You could use an app event to change the config values at runtime, App::booting should be appropriate for this. In app/start/global.php:

App::booting(function() {
    if (Session::get(...)) Config::set(...);
});

Note that this may not always have the results you expect. For example, as soon as the app is started, it checks the config for app.debug == true and chooses its exception handler accordingly, so if you'd want to change the exception handler after the app has started, you'd have to do it directly via app('exception')->setDebug(true). There may be any number of similar configurations you need to do, depending on your setup.