laravel / lumen-framework

The Laravel Lumen Framework.
https://lumen.laravel.com
MIT License
1.48k stars 419 forks source link

config app removes details error page? #1088

Closed Countryen closed 4 years ago

Countryen commented 4 years ago

Windows 10 x64, using WAMPSERVER 3.1.4 and PowerShell 7

Description:

Installed first Lumen app today with composer create-project --prefer-dist laravel/laravel blog. Then added a simple error to test the debug page, shows Symfony Debug page (OK). After adding some config the debug page disappeared, instead the following was shown: image

After some try and error I found out that placing a file called "app.php" inside a "config" folder results in this.

Why? Am I not supposed to add a "config"-folder and a app.php to add the config via $app->configure('app');? Is this supposed to happen? Where should I put my config files?

Full tree:

/.vscode
/app
/bootstrap
/config                        <------
    app.php                    <------
    test.php
    db.php
/database
...
.env
.env.example

Only happens when the folder name and file name is exactly as written.

Note: Even after removing the registration for "app" inside bootstrap, the detailed error page is missing. Note: Also happens when adding content to the app.php image

Steps To Reproduce:

  1. composer create-project --prefer-dist laravel/lumen test-debug
  2. add error throwing
  3. start server, run index and validate output (Symfony Debug Page is shown)
  4. add new folder /config
  5. add new file "app.php" into /config
  6. run index again, validate output (no Symfony Debug Page is shown)

Note: How to throw simple error, inside /routes/web.php image

GrahamCampbell commented 4 years ago

What did you put in the app.php file?

Countryen commented 4 years ago

@GrahamCampbell First, nothing (just empty file), then

<?php
return ["test" => "test"];

for config/db.php I did the same with ["dataFolderPath => "..."]. This works fine. For config/app.php it doesn't matter what I put in it.

GrahamCampbell commented 4 years ago

If you provide an app.php file, it should match the baseline file from the framework, otherwise you will get an error 500, like you saw.

Countryen commented 4 years ago

@GrahamCampbell Where is the "baseline file"? Or where can I get information about that? As said, I Just created the project using composer and added 1 file and 1 folder. I did not find any info about how or where to put my config files, only how to register them (lumen documentation).

Countryen commented 4 years ago

Found this "folder" https://github.com/laravel/lumen-framework/tree/7.x/config Does that mean, naming my config-files like any of these will "overwrite" them? Would be cool if this was mentioned in the documentation or at least if there was a sample config file in the create-project template (there is one for .env but I am not supposed to only use .env files, am I?)

GrahamCampbell commented 4 years ago

Does that mean, naming my config-files like any of these will "overwrite" them?

Yes, of course.

Countryen commented 4 years ago

Okay, I suggest to add that info to the https://lumen.laravel.com/docs/7.x/configuration docs. Or is there anywhere info about how and where to store config values (other than .env?).

I guess in my case I just don't use the same names, probably like custom_app.php or smth. The question/suggestion still is open, other than that, this issue can be closed :)

Countryen commented 4 years ago

To add some meaning:

Why aren't all of the /config/*-files added to the lumen application? It seems like they are for laravel apps? That would probably help pretty much as you instantly understand and see all the config values and where/how to store them.

I think I just copy & paste them into my application to have the full picture.

(Also, if there is a specific repo just for "docs" that I didn't find then please just move that issue there)

GrahamCampbell commented 4 years ago

Why aren't all of the /config/*-files added to the lumen application?

Because the lumen base structure is designed to be minimal. If you'd like everything in place, or are new to Laravel, I'd recommend using the full Laravel framework, and not Lumen.