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
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Changelog

## v1.2.0 (TBD)

- Added `icon_type` parameter for widgets: `fa` (Font Awesome, default) or `text` (for emoji/plain text)

## v1.1.0 (2025-11-07)

- Added support for multiple config filenames: `.disco-devbar.yaml`, `.disco-devbar.yml`

## v1.0.0 (2025-qq-05)
## v1.0.0 (2025-11-05)

- Initial public release
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,34 @@

# Welcome!

Development toolbar/banner for Symfony worktree-based workflows. Displays project information, links
to tools, and ticket details in development environment.
**DiscoDevBar** is a developer tool that adds a customizable toolbar/banner to your Symfony application,
providing all-time access to essential development resources right from your browser. Perfect for
streamlining your development workflow by keeping frequently-used tools, admin panels, and services
just one click away.

## What is DiscoDevBar?

DiscoDevBar creates a persistent banner (typically placed at the top of your layout) that displays
during development. It's highly configurable via YAML, allowing you to create custom buttons and
links to anything you need: admin panels, database tools, email catchers, API documentation, or
any other development resource.

### Perfect for Docker Environments

Since configuration is YAML-based, it's incredibly easy to generate dynamically when setting up new
development environments. When using Docker or similar containerization, port numbers often change
between setups - but with DiscoDevBar, you can regenerate the configuration file on each environment
startup, ensuring all links always point to the correct ports and services.

## Features

- Widget-based configuration system via YAML
- Displays milestone, PR, and ticket information
- Quick links to admin panel, phpMyAdmin, Mailpit
- Customizable icons, text, and links
- Only loads in development environment
- Zero production overhead
- **Fully customizable via YAML** - Easy to configure and regenerate for different environments
- **Flexible widget system** - Create buttons with Font Awesome icons, emoji, text labels, or any combination
- **Display anything** - Add links to admin panels, database tools, email catchers, API docs, or any development resource
- **Action buttons** - Direct access to frequently-used tools and services
- **Environment-aware** - Only loads in development environment, zero production overhead
- **Dynamic configuration** - Perfect for Docker setups where ports change - regenerate config on startup
- **Customizable placement** - Position widgets on left or right side of the toolbar

## Requirements

Expand Down
16 changes: 14 additions & 2 deletions Resources/views/devbar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
{% if widget.target %}target="{{ widget.target }}"{% endif %}
{% if widget.title %}title="{{ widget.title }}"{% endif %}>
<span class="disco-devbar-link-content">
{% if widget.icon %}<i class="fa-solid {{ widget.icon }}"></i>{% endif %}
{% if widget.icon %}
{% if widget.iconType.value == 'fa' %}
<i class="fa-solid {{ widget.icon }}"></i>
{% else %}
{{ widget.icon }}
{% endif %}
{% endif %}
{% if widget.text %}{{ widget.text }}{% endif %}
</span>
</a>
Expand All @@ -34,7 +40,13 @@
{% if widget.target %}target="{{ widget.target }}"{% endif %}
{% if widget.title %}title="{{ widget.title }}"{% endif %}>
<span class="disco-devbar-link-content">
{% if widget.icon %}<i class="fa-solid {{ widget.icon }}"></i>{% endif %}
{% if widget.icon %}
{% if widget.iconType.value == 'fa' %}
<i class="fa-solid {{ widget.icon }}"></i>
{% else %}
{{ widget.icon }}
{% endif %}
{% endif %}
{% if widget.text %}{{ widget.text }}{% endif %}
</span>
</a>
Expand Down
27 changes: 27 additions & 0 deletions src/Dto/IconType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

/* #############################################################################
*
* █▀▀▄ ▀ █▀▀▄ █▀▀▄
* █ █ ▀█ ▄▀▀▄ ▄▀▀▄ ▄▀▀▄ █ █ ▄▀▀▄ █ █ █▀▀▄ ▄▀▀▄ █▄▀
* █ █ █ ▀▄ █ █ █ █ █ █▀▀ █ █ █ █ ▄▄█ █
* █▄▄▀ ▄█▄ ▀▄▄▀ ▀▄▄▀ ▀▄▄▀ █▄▄▀ ▀▄▄▀ ▀▄▀ █▄▄▀ ▀▄▄▀ █
*
* Customizable developer toolbar for Symfony projects
*
* @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
* @copyright 2025 Marcin Orlowski
* @license https://opensource.org/license/mit MIT
* @link https://github.com/MarcinOrlowski/php-symfony-discodevbar
*
* ########################################################################## */

namespace MarcinOrlowski\DiscoDevBar\Dto;

enum IconType: string
{
case FONT_AWESOME = 'fa';
case TEXT = 'text';
}
17 changes: 10 additions & 7 deletions src/Dto/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function __construct(
public readonly string $url,
public readonly string $target,
public readonly string $title,
public readonly bool $expand
public readonly bool $expand,
public readonly IconType $iconType = IconType::FONT_AWESOME
) {
}

Expand All @@ -45,14 +46,16 @@ public static function fromArray(array $data): self
$target = $data['target'] ?? '';
$title = $data['title'] ?? '';
$expand = $data['expand'] ?? false;
$iconType = $data['icon_type'] ?? 'fa';

return new self(
icon: \is_string($icon) ? $icon : '',
text: \is_string($text) ? $text : '',
url: \is_string($url) ? $url : '',
target: \is_string($target) ? $target : '',
title: \is_string($title) ? $title : '',
expand: \is_bool($expand) ? $expand : false
icon: \is_string($icon) ? $icon : '',
text: \is_string($text) ? $text : '',
url: \is_string($url) ? $url : '',
target: \is_string($target) ? $target : '',
title: \is_string($title) ? $title : '',
expand: \is_bool($expand) ? $expand : false,
iconType: IconType::tryFrom(\is_string($iconType) ? $iconType : 'fa') ?? IconType::FONT_AWESOME
);
}
}