Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* text=auto eol=lf

*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
/tests export-ignore
CHANGELOG.md export-ignore
phpstan.neon export-ignore
phpstan-baseline.neon export-ignore
phpunit.xml.dist export-ignore
rector.php export-ignore
sonar-project.properties export-ignore
8 changes: 8 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use Phenix\App;
use Phenix\Facades\Config;
use Phenix\Facades\Log;
use Phenix\Facades\Translator;
use Phenix\Http\Response;
Expand Down Expand Up @@ -40,6 +41,13 @@ function env(string $key, Closure|null $default = null): array|string|float|int|
}
}

if (! function_exists('config')) {
function config(string $key, mixed $default = null): mixed
{
return Config::get($key, $default);
}
}

if (! function_exists('value')) {
function value($value, ...$args)
{
Expand Down
6 changes: 6 additions & 0 deletions tests/Unit/Runtime/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@

expect($config->get('app.name'))->toBe('PHPhenix');
});

it('retrieve configurations from global config helper function', function (): void {
config('app.name', 'DefaultApp');

expect(config('app.name'))->toBe('Phenix');
});