From 210333eb4d3173de5eedeff425d971beb9eedfdf Mon Sep 17 00:00:00 2001 From: barbosa89 Date: Fri, 7 Nov 2025 12:20:55 -0500 Subject: [PATCH 1/4] feat: add config function to retrieve configuration values --- src/functions.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/functions.php b/src/functions.php index 0f25cf0d..5cdac918 100644 --- a/src/functions.php +++ b/src/functions.php @@ -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; @@ -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) { From 5d908c2170ce01ae77c2bdae78002796f4a79f35 Mon Sep 17 00:00:00 2001 From: barbosa89 Date: Fri, 7 Nov 2025 12:24:52 -0500 Subject: [PATCH 2/4] test: add unit test for retrieving configurations using global config helper --- tests/Unit/Runtime/ConfigTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/Unit/Runtime/ConfigTest.php b/tests/Unit/Runtime/ConfigTest.php index 11cd9d32..446d5657 100644 --- a/tests/Unit/Runtime/ConfigTest.php +++ b/tests/Unit/Runtime/ConfigTest.php @@ -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'); +}); From 5003a1fecc162251b8bf031e77f36727cadeafad Mon Sep 17 00:00:00 2001 From: barbosa89 Date: Fri, 7 Nov 2025 12:34:55 -0500 Subject: [PATCH 3/4] feat: add .gitattributes file to manage end-of-line and export-ignore settings --- .gitattributes | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..0c3bba36 --- /dev/null +++ b/.gitattributes @@ -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 \ No newline at end of file From be7487ad6ddd72e5c6de32e5d74d83fce97e9473 Mon Sep 17 00:00:00 2001 From: barbosa89 Date: Fri, 7 Nov 2025 12:35:34 -0500 Subject: [PATCH 4/4] fix: ensure sonar-project.properties is properly exported in .gitattributes --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 0c3bba36..86da81e1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,4 +12,4 @@ phpstan.neon export-ignore phpstan-baseline.neon export-ignore phpunit.xml.dist export-ignore rector.php export-ignore -sonar-project.properties export-ignore \ No newline at end of file +sonar-project.properties export-ignore