Search by

lakamark / image-dock-core

lakamark

Framework-independent PHP library for storing original images, generating variants, and publishing image lifecycle events.

v1.0.0-alpha.2 2026-12-02 23:39 UTC

This package is auto-updated.

Last update: 2026-12-02 23:54:52 UTC


README

Core CI PHP 8.5 MIT License

Warning

1.0 Early Access. The alpha is intended for integration testing. The public API, configuration, and storage layout may change before 1.0.0. Production use is discouraged.

ImageDock Core is an extensible, framework-independent PHP library for storing original images, generating named variants, retrieving them on demand, and integrating image lifecycle events into external applications.

Features

Image Management

  • Store and retrieve original images.
  • Generate, retrieve, and regenerate named variants.
  • Discover configured variant names.
  • List stored originals and variants.
  • Delete originals and their associated variants.
  • Delete individual variants.

Image Processing

  • Built-in GD image engine.
  • WebP, PNG, and JPEG output.
  • Custom image engines and variant generators.

Storage

  • Local storage and custom storage adapters.
  • Configurable file naming strategies.

Event System

  • PSR-14 compatible event dispatcher.
  • Manual and attribute-based listener registration.
  • Event subscribers with priority-based execution.
  • Custom event dispatching.
  • Synchronous image lifecycle events.
  • Optional integration with external PSR-14 event dispatchers.

Architecture

  • Framework-independent application API.
  • Explicit public API and extension point boundaries.
  • Extensible architecture through documented contracts.
  • Internal and cross-project architecture validation tools.

Requirements

  • PHP 8.5 (^8.5 in Composer).
  • Composer 2.
  • PHP GD with support for the image formats used by the built-in engine.

Storing and retrieving images does not require an image engine.

The event system does not require a specific PHP framework or dependency injection container.

Installation

To install ImageDock Core from Packagist, run this command from your application directory.

composer require "lakamark/image-dock-core:1.0.0-alpha.2"

To install directly from GitHub after the alpha tag is available, register the official repository as a Composer VCS source.

composer config repositories.image-dock-core vcs https://github.com/Lakamark/imagedock-core.git
composer require "lakamark/image-dock-core:1.0.0-alpha.2"

Quick Start

Save this script next to your application’s vendor/ directory and a local photo.png file.

<?php

declare(strict_types=1);

use ImageDock\Core\Application\ApplicationConfig;
use ImageDock\Core\Application\ImageDockApplication;

require __DIR__ . '/vendor/autoload.php';

$app = ImageDockApplication::fromConfig(
    new ApplicationConfig(
        storageRoot: __DIR__ . '/storage/images',
    ),
);

$originalId = $app->storeOriginalFromFile(__DIR__ . '/photo.png');
$original = $app->getOriginal($originalId);

Event System

ImageDock provides a lightweight, synchronous event system based on the PSR-14 Event Dispatcher standard.

Applications can react to successful image lifecycle operations through the following events:

  • OriginalStoredEvent
  • OriginalDeletedEvent
  • VariantGeneratedEvent
  • VariantDeletedEvent

Event dispatcher configuration is optional.

Consumers may use ImageDock's built-in event dispatcher or provide their own PSR-14 compatible implementation.

Lifecycle events are published after successful storage operations. Listener failures propagate to the caller without automatically rolling back completed storage operations.

See the event system documentation and lifecycle events for integration examples and detailed behavior.

Architecture

ImageDockApplication is the supported public application entry point.

ImageDock Core distinguishes between public APIs, supported extension points, and internal implementation details.

Consumers should depend on documented public APIs and extension contracts rather than internal implementation details.

See the core architecture for more information.

Documentation

See the developer documentation for detailed usage, configuration, and extension guides.

How to participate

You can help by testing the alpha, reporting an issue, improving the documentation, or proposing a code change. See the contributing guide to get started.

Development

composer install
composer check

The composer check command runs PHPUnit, PHP_CodeSniffer, PHPStan, and ImageDock architecture validation.

Architecture validation can also be executed independently:

composer architecture

The GD tests require PNG, WebP, and JPEG support.

License

ImageDock Core is licensed under the MIT License.