Skip to content

Commit c98d805

Browse files
Support for various config file names (#2)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent e086d91 commit c98d805

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v1.1.0 (2025-11-07)
4+
5+
- Added support for multiple config filenames: `.disco-devbar.yaml`, `.disco-devbar.yml`
6+
37
## v1.0.0 (2025-qq-05)
48

59
- Initial public release

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ php bin/console assets:install --symlink
5151

5252
## Configuration
5353

54-
Create `.debug-banner.yaml` in your project root with widget configuration:
54+
Create a configuration file in your project root with widget configuration. The bundle will automatically
55+
detect and load the first file found (in order of preference):
56+
57+
- `.disco-devbar.yaml` (recommended)
58+
- `.disco-devbar.yml`
59+
60+
Example configuration:
5561

5662
```yaml
5763
widgets:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "marcin-orlowski/symfony-discodevbar",
33
"description": "Development toolbar/banner for Symfony project",
44
"type": "symfony-bundle",
5-
"version": "1.0.0",
5+
"version": "1.1.0",
66
"license": "MIT",
77
"keywords": [
88
"symfony",

src/Service/DiscoDevBarService.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@
2626

2727
class DiscoDevBarService
2828
{
29-
private const CONFIG_FILE = '.debug-banner.yaml';
29+
/**
30+
* List of supported config filenames (in order of preference)
31+
*/
32+
private const CONFIG_FILES = [
33+
'.disco-devbar.yaml',
34+
'.disco-devbar.yml',
35+
'.debug-banner.yaml', // Legacy, kept for backward compatibility
36+
];
3037

3138
public function __construct(
3239
private readonly string $projectDir
@@ -35,10 +42,10 @@ public function __construct(
3542

3643
public function getDiscoDevBarData(): DiscoDevBarData
3744
{
38-
$configPath = $this->projectDir . '/' . self::CONFIG_FILE;
45+
$configPath = $this->findConfigFile();
3946

4047
// Default: empty widgets
41-
if (!\file_exists($configPath)) {
48+
if ($configPath === null) {
4249
return new DiscoDevBarData(
4350
left: [],
4451
right: [],
@@ -73,6 +80,23 @@ public function getDiscoDevBarData(): DiscoDevBarData
7380
);
7481
}
7582

83+
/**
84+
* Find the first existing config file from the list of supported filenames
85+
*
86+
* @return string|null Full path to config file or null if none found
87+
*/
88+
private function findConfigFile(): ?string
89+
{
90+
foreach (self::CONFIG_FILES as $filename) {
91+
$path = $this->projectDir . '/' . $filename;
92+
if (\file_exists($path)) {
93+
return $path;
94+
}
95+
}
96+
97+
return null;
98+
}
99+
76100
/**
77101
* Check if any widget in the array has expand=true
78102
*

0 commit comments

Comments
 (0)