Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s

- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3)
- Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung
- Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü
- Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person
- Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“
- Benutzerverwaltung im Admin, Zugang vorläufig über is_admin
- vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/
- PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung
- VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-25 20:35:30 +00:00
parent 7197eaebf2
commit 9c0f8de791
15771 changed files with 1564103 additions and 5 deletions

View file

@ -0,0 +1,8 @@
<?php
namespace Filament\Support\Components\Attributes;
use Attribute;
#[Attribute(Attribute::TARGET_METHOD)]
class ExposedLivewireMethod {}

View file

@ -0,0 +1,18 @@
<?php
namespace Filament\Support\Components;
use Filament\Support\Concerns\Configurable;
use Filament\Support\Concerns\EvaluatesClosures;
use Filament\Support\Concerns\Macroable;
use Illuminate\Support\Traits\Conditionable;
use Illuminate\Support\Traits\Tappable;
abstract class Component
{
use Conditionable;
use Configurable;
use EvaluatesClosures;
use Macroable;
use Tappable;
}

View file

@ -0,0 +1,176 @@
<?php
namespace Filament\Support\Components;
use Closure;
use Filament\Support\Components\Contracts\ScopedComponentManager;
use ReflectionClass;
use ReflectionMethod;
use ReflectionNamedType;
class ComponentManager implements ScopedComponentManager
{
/**
* @var array<class-string, array<Closure>>
*/
protected array $configurations = [];
/**
* @var array<class-string, array<Closure>>
*/
protected array $importantConfigurations = [];
/**
* @var array<string, array<string>>
*/
protected array $methodCache = [];
/**
* @var array<class-string, array<class-string>>
*/
protected array $configureClassHierarchyCache = [];
/**
* @var array<class-string, class-string>
*/
protected array $setUpMethodClassCache = [];
final public function __construct() {}
public static function resolve(): ScopedComponentManager
{
if (app()->resolved(ScopedComponentManager::class)) {
return static::resolveScoped();
}
app()->singletonIf(
ComponentManager::class,
fn () => new ComponentManager,
);
return app(ComponentManager::class);
}
public static function resolveScoped(): ScopedComponentManager
{
return app(ScopedComponentManager::class);
}
public function clone(): static
{
return clone $this;
}
public function configureUsing(string $component, Closure $modifyUsing, ?Closure $during = null, bool $isImportant = false): mixed
{
if ($isImportant) {
$this->importantConfigurations[$component] ??= [];
$this->importantConfigurations[$component][] = $modifyUsing;
} else {
$this->configurations[$component] ??= [];
$this->configurations[$component][] = $modifyUsing;
}
if (! $during) {
$configurationKey = $isImportant ?
array_key_last($this->importantConfigurations[$component]) :
array_key_last($this->configurations[$component]);
return function () use ($component, $configurationKey, $isImportant): void {
if ($isImportant) {
unset($this->importantConfigurations[$component][$configurationKey]);
return;
}
unset($this->configurations[$component][$configurationKey]);
};
}
try {
return $during();
} finally {
if ($isImportant) {
array_pop($this->importantConfigurations[$component]);
} else {
array_pop($this->configurations[$component]);
}
}
}
public function configure(Component $component, Closure $setUp): void
{
$componentClass = $component::class;
$classesToConfigure = $this->configureClassHierarchyCache[$componentClass]
??= [...array_reverse(class_parents($component)), $componentClass];
$setUpMethodClass = $this->setUpMethodClassCache[$componentClass]
??= (new ReflectionMethod($component, 'setUp'))->getDeclaringClass()->getName();
foreach ($classesToConfigure as $classToConfigure) {
if ($classToConfigure === $setUpMethodClass) {
$setUp();
}
if (array_key_exists($classToConfigure, $this->configurations)) {
foreach ($this->configurations[$classToConfigure] as $configure) {
$configure($component);
}
}
}
foreach ($classesToConfigure as $classToConfigure) {
if (array_key_exists($classToConfigure, $this->importantConfigurations)) {
foreach ($this->importantConfigurations[$classToConfigure] as $configure) {
$configure($component);
}
}
}
}
/**
* @return array<string, Closure>
*/
public function extractPublicMethods(Component $component): array
{
if (! isset($this->methodCache[$component::class])) {
$reflection = new ReflectionClass($component);
$this->methodCache[$component::class] = [];
// The `static`-return filter only applies to first-party Filament
// classes, since their fluent setters are never called from any
// Blade view we ship. Third-party subclasses might legitimately
// call their own setters from a published view, so we leave their
// method lists untouched.
$shouldSkipFluentSetters = str_starts_with($component::class, 'Filament\\');
foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
$name = $method->getName();
if (str_starts_with($name, '__')) {
continue;
}
if ($shouldSkipFluentSetters) {
$returnType = $method->getReturnType();
if ($returnType instanceof ReflectionNamedType && $returnType->getName() === 'static') {
continue;
}
}
$this->methodCache[$component::class][] = $name;
}
}
$values = [];
foreach ($this->methodCache[$component::class] as $method) {
$values[$method] = $component->$method(...);
}
return $values;
}
}

View file

@ -0,0 +1,8 @@
<?php
namespace Filament\Support\Components\Contracts;
interface HasEmbeddedView
{
public function toEmbeddedHtml(): string;
}

View file

@ -0,0 +1,18 @@
<?php
namespace Filament\Support\Components\Contracts;
use Closure;
use Filament\Support\Components\Component;
interface ScopedComponentManager
{
public function configureUsing(string $component, Closure $modifyUsing, ?Closure $during = null, bool $isImportant = false): mixed;
public function configure(Component $component, Closure $setUp): void;
/**
* @return array<string, Closure>
*/
public function extractPublicMethods(Component $component): array;
}

View file

@ -0,0 +1,234 @@
<?php
namespace Filament\Support\Components;
use Closure;
use Filament\Support\Components\Contracts\HasEmbeddedView;
use Filament\Support\View\ComponentAttributeBag as FilamentComponentAttributeBag;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Arr;
use Illuminate\Support\HtmlString;
use Illuminate\View\FileViewFinder;
use LogicException;
abstract class ViewComponent extends Component implements Htmlable
{
protected string $view;
/**
* @var view-string | Closure | null
*/
protected string | Closure | null $defaultView = null;
/**
* @var array<array<string, mixed> | Closure>
*/
protected array $viewData = [];
protected string $viewIdentifier;
/**
* @var array<view-string, View>
*/
protected array $viewInstances = [];
protected ?string $publishedViewOverrideCheckPath = null;
/**
* @var array<string, bool>
*/
private static array $hasPublishedEmbeddedViewOverrideCache = [];
/**
* @param view-string | null $view
* @param array<string, mixed> | Closure $viewData
*/
public function view(?string $view, array | Closure $viewData = []): static
{
if ($view === null) {
return $this;
}
$this->view = $view;
if (filled($viewData)) {
$this->viewData($viewData);
}
return $this;
}
/**
* @param view-string | Closure | null $view
*/
public function defaultView(string | Closure | null $view): static
{
$this->defaultView = $view;
return $this;
}
/**
* @return array<string, Closure>
*/
protected function extractPublicMethods(): array
{
return ComponentManager::resolve()->extractPublicMethods($this);
}
/**
* @param array<string, mixed> | Closure $data
*/
public function viewData(array | Closure $data): static
{
$this->viewData[] = $data;
return $this;
}
/**
* @return view-string
*/
public function getView(): string
{
if (isset($this->view)) {
return $this->view;
}
if (filled($defaultView = $this->getDefaultView())) {
return $defaultView;
}
throw new LogicException('Class [' . static::class . '] extends [' . ViewComponent::class . '] but does not have a [$view] property defined.');
}
public function hasView(): bool
{
return isset($this->view) || $this->getDefaultView();
}
/**
* @return view-string | null
*/
public function getDefaultView(): ?string
{
return $this->evaluate($this->defaultView);
}
/**
* @return array<string, mixed>
*/
public function getViewData(): array
{
return Arr::mapWithKeys(
$this->viewData,
fn (mixed $data): array => $this->evaluate($data) ?? [],
);
}
public function toHtml(): string
{
if ((! ($this instanceof HasEmbeddedView)) || $this->hasView()) {
return $this->render()->render();
}
$publishedViewOverrideCheckPath = $this->getPublishedViewOverrideCheckPath();
if (filled($publishedViewOverrideCheckPath) && static::hasPublishedEmbeddedViewOverride($publishedViewOverrideCheckPath)) {
static::registerPublishedEmbeddedViewOverrideNamespace($publishedViewOverrideCheckPath);
return $this->renderView($publishedViewOverrideCheckPath)->render();
}
return $this->toEmbeddedHtml();
}
public function getPublishedViewOverrideCheckPath(): ?string
{
return $this->publishedViewOverrideCheckPath;
}
public static function hasPublishedEmbeddedViewOverride(string $view): bool
{
return self::$hasPublishedEmbeddedViewOverrideCache[$view] ??= self::checkForPublishedEmbeddedViewOverride($view);
}
protected static function checkForPublishedEmbeddedViewOverride(string $view): bool
{
if (! str_contains($view, '::')) {
return false;
}
[$namespace, $name] = explode('::', $view, 2);
return file_exists(resource_path('views/vendor/' . $namespace . '/' . str_replace('.', '/', $name) . '.blade.php'));
}
protected static function registerPublishedEmbeddedViewOverrideNamespace(string $view): void
{
if (! str_contains($view, '::')) {
return;
}
[$namespace] = explode('::', $view, 2);
$factory = app('view');
$overridePath = resource_path('views/vendor/' . $namespace);
// Laravel only registers the published override path as a namespace hint if the
// directory already exists when the `view` factory is first resolved. Livewire 4
// resolves the factory early during boot, so an override published afterwards is
// never picked up. Registering the location here keeps overrides working regardless
// of when the `view` factory was resolved.
$finder = $factory->getFinder();
if ($finder instanceof FileViewFinder && in_array($overridePath, $finder->getHints()[$namespace] ?? [], true)) {
return;
}
$factory->prependNamespace($namespace, $overridePath);
}
public function toHtmlString(): ?HtmlString
{
$html = $this->toHtml();
if (blank($html)) {
return null;
}
return new HtmlString($html);
}
/**
* @return array<string, mixed>
*/
public function getExtraViewData(): array
{
return [];
}
public function render(): View
{
return $this->renderView($this->getView());
}
/**
* @param view-string $view
*/
protected function renderView(string $view): View
{
$this->viewInstances[$view] ??= view($view, [
...$this->extractPublicMethods(),
...(isset($this->viewIdentifier) ? [$this->viewIdentifier => $this] : []),
]);
return $this->viewInstances[$view]->with([
'attributes' => new FilamentComponentAttributeBag,
...$this->getExtraViewData(),
...$this->getViewData(),
]);
}
}