Skip to content

refactor: Modernize horde/Image to PER-1, PSR-4, typed interfaces and DI-friendly design#6

Merged
ralflang merged 4 commits into
FRAMEWORK_6_0from
feat/modern-psr4-typed-interfaces
May 24, 2026
Merged

refactor: Modernize horde/Image to PER-1, PSR-4, typed interfaces and DI-friendly design#6
ralflang merged 4 commits into
FRAMEWORK_6_0from
feat/modern-psr4-typed-interfaces

Conversation

@ralflang
Copy link
Copy Markdown
Member

@ralflang ralflang commented May 24, 2026

Summary

New modern API under src/ (Horde\Image namespace, PSR-4 autoloaded) coexists with legacy lib/ code. PHP 8.2+ strict types throughout.

What changed

Interfaces

  • ImageDriver / ImageResource / SequenceDriver hierarchy (ISP split)

Backends

  • ImagickDriver, GdDriver, ImDriver (CLI), SvgDriver, PngDriver (pure PHP), NullDriver

Color

  • Immutable Color value object with named(), lighten(), darken(), intensify(), brightness(), toGray()
  • NamedColors lookup (140+ CSS color names)

Drawing

  • DrawingContext with path-based API and state stack
  • SvgDrawingContext producing SVG DOM output
  • Brush utility with BrushShape enum (Square, Circle, Diamond, Triangle)
  • FontSize enum with bidirectional lookup (Tiny/Small/Medium/Large/Giant)
  • TextStyle accepts FontSize or raw float

Filters

  • Brightness, Contrast, Gamma, Grayscale, Colorize, Modulate, Sepia, Negate, Sharpen, Pixelate, Blur

Effects

  • TextWatermark, PolaroidImage, PhotoStack, Border, DropShadow, RoundCorners, SmartCrop, CenterCrop, LiquidResize, Composite

Sequences

  • ImageSequence / Frame / AnimationOptions for multi-frame images

Metadata

  • BundledReader, PhpExifReader, ImagickReader, ExiftoolReader
  • GPS parsing and MakerNote support (Canon, Nikon, Fujifilm, Olympus, Panasonic, Sanyo)

Other

  • ImageFactory DI wrapper
  • Full PHPStan level 8 compliance

Not yet ported from legacy

  • SWF/Flash backend (Flash EOL 2020)

Test plan

  • 537 tests, 3099 assertions passing
  • PHPStan level 8 clean on all src/ files
  • php -l syntax check on all files

@ralflang ralflang force-pushed the feat/modern-psr4-typed-interfaces branch from 602b016 to 5aeedda Compare May 24, 2026 14:44
ralflang added 4 commits May 24, 2026 17:07
… DI-friendly design

New modern API under src/ (Horde\Image namespace, PSR-4 autoloaded)
coexists with legacy lib/ code. PHP 8.2+ strict types throughout.

What changed:
- ImageDriver/ImageResource/SequenceDriver interface hierarchy (ISP)
- ImagickDriver, GdDriver, ImDriver (CLI), SvgDriver, PngDriver,
  NullDriver backends
- Immutable Color value object with named(), lighten(), darken(),
  intensify(), brightness(), toGray() utilities
- NamedColors lookup (140+ CSS color names)
- DrawingContext with path-based API and state stack
- SvgDrawingContext producing SVG DOM output
- Brush utility with BrushShape enum (Square, Circle, Diamond, Triangle)
- FontSize enum with bidirectional lookup (Tiny/Small/Medium/Large/Giant)
- TextStyle accepts FontSize or raw float
- Filter classes: Brightness, Contrast, Gamma, Grayscale, Colorize,
  Modulate, Sepia, Negate, Sharpen, Pixelate, Blur
- Effect classes: TextWatermark, PolaroidImage, PhotoStack, Border,
  DropShadow, RoundCorners, SmartCrop, CenterCrop, LiquidResize,
  Composite
- ImageSequence/Frame/AnimationOptions for multi-frame images
- Metadata system: BundledReader, PhpExifReader, ImagickReader,
  ExiftoolReader with GPS parsing and MakerNote support
- ImageFactory DI wrapper
- Pure PHP PNG writer (PngDriver) as zero-dependency fallback
- Full PHPStan level 8 compliance

Not yet ported from legacy:
- SWF/Flash backend (Flash EOL 2020)
@ralflang ralflang force-pushed the feat/modern-psr4-typed-interfaces branch from 5aeedda to 8151954 Compare May 24, 2026 15:07
@ralflang ralflang merged commit 6db75d4 into FRAMEWORK_6_0 May 24, 2026
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant