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,306 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Typography;
use Intervention\Image\Alignment;
use Intervention\Image\Exceptions\DirectoryNotFoundException;
use Intervention\Image\Exceptions\FileNotFoundException;
use Intervention\Image\Exceptions\FileNotReadableException;
use Intervention\Image\Exceptions\FilesystemException;
use Intervention\Image\Exceptions\InvalidArgumentException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\FontInterface;
use Intervention\Image\Traits\CanParseFilePath;
use TypeError;
use ValueError;
class Font implements FontInterface
{
use CanParseFilePath;
public function __construct(
protected ?string $filepath = null,
protected float $size = 12,
protected float $angle = 0,
protected string|ColorInterface $color = '000000',
protected string|ColorInterface $strokeColor = 'ffffff',
protected int $strokeWidth = 0,
protected Alignment $alignmentHorizontal = Alignment::LEFT,
protected Alignment $alignmentVertical = Alignment::BOTTOM,
protected float $lineHeight = 1.25,
protected ?int $wrapWidth = null,
) {
//
}
/**
* {@inheritdoc}
*
* @see FontInterface::setSize()
*/
public function setSize(float $size): FontInterface
{
$this->size = $size;
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::size()
*/
public function size(): float
{
return $this->size;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setAngle()
*/
public function setAngle(float $angle): FontInterface
{
$this->angle = $angle;
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::angle()
*/
public function angle(): float
{
return $this->angle;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setFilepath()
*
* @throws InvalidArgumentException
* @throws DirectoryNotFoundException
* @throws FileNotFoundException
* @throws FileNotReadableException
*/
public function setFilepath(string $path): FontInterface
{
$this->filepath = self::readableFilePathOrFail($path);
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::filepath()
*/
public function filepath(): ?string
{
try {
return self::readableFilePathOrFail($this->filepath);
} catch (FilesystemException | InvalidArgumentException) {
return null;
}
}
/**
* {@inheritdoc}
*
* @see FontInterface::hasFile()
*/
public function hasFile(): bool
{
return $this->filepath() !== null;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setColor()
*/
public function setColor(string|ColorInterface $color): FontInterface
{
$this->color = $color;
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::color()
*/
public function color(): null|string|ColorInterface
{
return $this->color;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setStrokeColor()
*/
public function setStrokeColor(string|ColorInterface $color): FontInterface
{
$this->strokeColor = $color;
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::strokeColor()
*/
public function strokeColor(): null|string|ColorInterface
{
return $this->strokeColor;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setStrokeWidth()
*
* @throws InvalidArgumentException
*/
public function setStrokeWidth(int $width): FontInterface
{
if (!in_array($width, range(0, 10))) {
throw new InvalidArgumentException(
'The stroke width must be in the range from 0 to 10',
);
}
$this->strokeWidth = $width;
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::strokeWidth()
*/
public function strokeWidth(): int
{
return $this->strokeWidth;
}
/**
* {@inheritdoc}
*
* @see FontInterface::hasStrokeEffect()
*/
public function hasStrokeEffect(): bool
{
return $this->strokeWidth > 0;
}
/**
* {@inheritdoc}
*
* @see FontInterface::alignmentHorizontal()
*/
public function alignmentHorizontal(): Alignment
{
return $this->alignmentHorizontal;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setAlignmentHorizontal()
*
* @throws InvalidArgumentException
*/
public function setAlignmentHorizontal(string|Alignment $alignment): FontInterface
{
try {
$this->alignmentHorizontal = is_string($alignment) ? Alignment::from($alignment) : $alignment;
} catch (ValueError | TypeError) {
throw new InvalidArgumentException('Invalid value for alignment');
}
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::alignmentVertical()
*/
public function alignmentVertical(): Alignment
{
return $this->alignmentVertical;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setAlignmentVertical()
*
* @throws InvalidArgumentException
*/
public function setAlignmentVertical(string|Alignment $alignment): FontInterface
{
try {
$this->alignmentVertical = is_string($alignment) ? Alignment::from($alignment) : $alignment;
} catch (ValueError | TypeError) {
throw new InvalidArgumentException('Invalid value for alignment');
}
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setLineHeight()
*/
public function setLineHeight(float $height): FontInterface
{
$this->lineHeight = $height;
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::lineHeight()
*/
public function lineHeight(): float
{
return $this->lineHeight;
}
/**
* {@inheritdoc}
*
* @see FontInterface::setWrapWidth()
*/
public function setWrapWidth(?int $width): FontInterface
{
$this->wrapWidth = $width;
return $this;
}
/**
* {@inheritdoc}
*
* @see FontInterface::wrapWidth()
*/
public function wrapWidth(): ?int
{
return $this->wrapWidth;
}
}

View file

@ -0,0 +1,149 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Typography;
use Intervention\Image\Alignment;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\FontInterface;
class FontFactory
{
protected FontInterface $font;
/**
* Create new instance.
*/
public function __construct(null|callable|FontInterface $font = null)
{
$this->font = $font instanceof FontInterface ? clone $font : new Font();
if (is_callable($font)) {
$font($this);
}
}
/**
* Create the font statically by calling the given callable.
*/
public static function build(null|callable|FontInterface $font = null): FontInterface
{
return (new self($font))->font();
}
/**
* Return the font.
*/
public function font(): FontInterface
{
return $this->font;
}
/**
* Set the filename of the font to be built.
*/
public function filename(string $path): self
{
$this->font->setFilepath($path);
return $this;
}
/**
* {@inheritdoc}
*
* @see self::filename()
*/
public function file(string $path): self
{
return $this->filename($path);
}
/**
* {@inheritdoc}
*
* @see self::filename()
*/
public function filepath(string $path): self
{
return $this->filename($path);
}
/**
* Set outline stroke effect for the font to be built.
*/
public function stroke(string|ColorInterface $color, int $width = 1): self
{
$this->font->setStrokeWidth($width);
$this->font->setStrokeColor($color);
return $this;
}
/**
* Set color for the font to be built.
*/
public function color(string|ColorInterface $color): self
{
$this->font->setColor($color);
return $this;
}
/**
* Set the size for the font to be built.
*/
public function size(float $size): self
{
$this->font->setSize($size);
return $this;
}
/**
* Set the horizontal and/or vertical alignment of the font.
*/
public function align(null|string|Alignment $horizontal = null, null|string|Alignment $vertical = null): self
{
if ($horizontal !== null) {
$this->font->setAlignmentHorizontal($horizontal);
}
if ($vertical !== null) {
$this->font->setAlignmentVertical($vertical);
}
return $this;
}
/**
* Set the line height of the font to be built.
*/
public function lineHeight(float $height): self
{
$this->font->setLineHeight($height);
return $this;
}
/**
* Set the clockwise rotation angle of the font to be built.
*/
public function angle(float $angle): self
{
$this->font->setAngle($angle);
return $this;
}
/**
* Set the maximum width of the text block to be built.
*/
public function wrap(int $width): self
{
$this->font->setWrapWidth($width);
return $this;
}
}

View file

@ -0,0 +1,123 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Typography;
use ArrayIterator;
use Countable;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Interfaces\PointInterface;
use IteratorAggregate;
use Stringable;
use Traversable;
/**
* @implements IteratorAggregate<string>
*/
class Line implements IteratorAggregate, Countable, Stringable
{
/**
* Segments (usually individual words including punctuation marks) of the line.
*
* @var array<string>
*/
protected array $segments = [];
/**
* Create new text line object with given text & position.
*/
public function __construct(
?string $text = null,
protected PointInterface $position = new Point(),
) {
if (is_string($text)) {
$this->segments = $this->wordsSeparatedBySpaces($text) ? explode(" ", $text) : mb_str_split($text);
}
}
/**
* Add word to current line.
*/
public function add(string $word): self
{
$this->segments[] = $word;
return $this;
}
/**
* Returns Iterator.
*
* @return Traversable<string>
*/
public function getIterator(): Traversable
{
return new ArrayIterator($this->segments);
}
/**
* Get Position of line.
*/
public function position(): PointInterface
{
return $this->position;
}
/**
* Set position of current line.
*/
public function setPosition(PointInterface $point): self
{
$this->position = $point;
return $this;
}
/**
* Count segments (individual words including punctuation marks) of line.
*/
public function count(): int
{
return count($this->segments);
}
/**
* Count characters of line.
*/
public function length(): int
{
return mb_strlen((string) $this);
}
/**
* Determine if words are separated by spaces in the written language of the given text.
*/
private function wordsSeparatedBySpaces(string $text): bool
{
return 1 !== preg_match(
'/[' .
'\x{4E00}-\x{9FFF}' . // CJK Unified Ideographs (chinese)
'\x{3400}-\x{4DBF}' . // CJK Unified Ideographs Extension A (chinese)
'\x{3040}-\x{309F}' . // hiragana (japanese)
'\x{30A0}-\x{30FF}' . // katakana (japanese)
'\x{0E00}-\x{0E7F}' . // thai
']/u',
$text,
);
}
/**
* Cast line to string.
*/
public function __toString(): string
{
$string = implode("", $this->segments);
if ($this->wordsSeparatedBySpaces($string)) {
return implode(" ", $this->segments);
}
return $string;
}
}

View file

@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace Intervention\Image\Typography;
use Intervention\Image\Collection;
class TextBlock extends Collection
{
/**
* Create new text block object.
*/
public function __construct(string $text)
{
parent::__construct(array_map(
fn(string $line): Line => new Line($line),
explode("\n", $text),
));
}
/**
* Return array of lines in text block.
*
* @return array<Line>
*/
public function lines(): array
{
return $this->items;
}
/**
* Set lines of the text block.
*
* @param array<Line> $lines
*/
public function setLines(array $lines): self
{
$this->items = $lines;
return $this;
}
/**
* Get line by given key.
*/
public function line(string|int|float $key): ?Line
{
if (!array_key_exists((string) $key, $this->lines())) {
return null;
}
return $this->lines()[(string) $key];
}
/**
* Return line with most characters of text block.
*/
public function longestLine(): Line
{
$lines = $this->lines();
usort($lines, function (Line $a, Line $b): int {
if ($a->length() === $b->length()) {
return 0;
}
return $a->length() > $b->length() ? -1 : 1;
});
return $lines[0];
}
}