Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for Config #192

Open
paxperscientiam opened this issue Aug 31, 2021 · 0 comments
Open

Suggestion for Config #192

paxperscientiam opened this issue Aug 31, 2021 · 0 comments

Comments

@paxperscientiam
Copy link

paxperscientiam commented Aug 31, 2021

After much tinkering, I've come up with a way to access config data via Illuminate\Support\Facades\Config

This uses some code from the existing Config example and uses a container (using kint just for dumping):

<?PHP
use Illuminate\Support\Facades\Config;
use Illuminate\Container\Container;
use Illuminate\Config\Repository;

$config = new Repository(require(FILE_ROOT . "/config/app.php"));
$app = new Container();

$app->instance(
    'config',
    $config
);

Illuminate\Support\Facades\Facade::setFacadeApplication($app);
s($app->get('config')->get("app"));
s(Config::get('app'));

Output:
Screen Shot 2021-08-31 at 1 42 25 AM

Current example uses a slim app, so is incompatible with the above. Would it make sense to add a separate file like "components/config/example2.php" (for instance)?

EDIT: This may tie in some how to PR #191 ... but maybe not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant