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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Mindee PHP API Library Changelog

## v3.4.0 - 2026-10-28
### Changes
* :sparkles: swap out all PDF/Image handling features with Bernard L'Édit
* :coffin: drop pdfparser, FPDF/FPDI, ImageMagick, ghostscript
### Fixes
* :memo: fix changelog inconsistencies, and update to account for Bernard L'Édit
* :bug: fix faulty tests


## v3.3.1 - 2026-10-27
### Fixes
* :recycle: update deprecated syntaxes + add checks (addresses #225)
Expand Down
40 changes: 22 additions & 18 deletions src/Dependency/DependencyChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,44 @@
*/
class DependencyChecker
{
private const SUPPORTED_BERNARD_LEDIT = '0.1';

/**
* Whether the bernard_ledit extension is loaded.
* The bernard_ledit version this SDK release is built and tested against. composer.json's "conflict"
* pins the same version; DependencyCheckerTest checks that both agree.
*/
public static function isBernardLeditAvailable(): bool
{
return extension_loaded('bernard_ledit');
}
public const BERNARD_LEDIT_VERSION = '0.1.0';

/**
* @throws MindeeUnhandledException Throws if the extension is missing or has an unsupported version.
* @throws MindeeUnhandledException Throws if bernard_ledit isn't loaded, or isn't the supported version.
*/
public static function requireBernardLedit(): void
{
if (!self::isBernardLeditAvailable()) {
$install = sprintf('pie install mindee/bernard-ledit:%s', self::BERNARD_LEDIT_VERSION);
if (!extension_loaded('bernard_ledit')) {
throw new MindeeUnhandledException(
"To enable PDF and image features, install the 'bernard_ledit' PHP extension: "
. "pie install mindee/bernard-ledit:^" . self::SUPPORTED_BERNARD_LEDIT
. " (see https://github.com/mindee/bernard-ledit#php-binding)",
"To enable PDF and image features, install the 'bernard_ledit' PHP extension: $install "
. '(see https://github.com/mindee/bernard-ledit#php-binding)',
ErrorCode::USER_MISSING_DEPENDENCY
);
}
$version = phpversion('bernard_ledit') ?: '0';
if (!str_starts_with($version, self::SUPPORTED_BERNARD_LEDIT . '.')) {
$installed = phpversion('bernard_ledit');
if ($installed !== self::BERNARD_LEDIT_VERSION) {
throw new MindeeUnhandledException(
sprintf(
"bernard_ledit %s is installed, but this SDK supports %s.x: pie install mindee/bernard-ledit:^%s",
$version,
self::SUPPORTED_BERNARD_LEDIT,
self::SUPPORTED_BERNARD_LEDIT
'This version of the Mindee SDK needs bernard_ledit %s, but %s is installed: %s',
self::BERNARD_LEDIT_VERSION,
$installed,
$install
),
ErrorCode::USER_MISSING_DEPENDENCY
);
}
}

/**
* Whether the bernard_ledit extension is loaded.
*/
public static function isBernardLeditAvailable(): bool
{
return extension_loaded('bernard_ledit');
}
}
2 changes: 1 addition & 1 deletion src/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

namespace Mindee;

const VERSION = '3.3.1';
const VERSION = '3.4.0';
9 changes: 9 additions & 0 deletions tests/Dependencies/DependencyCheckerPdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ public function testBernardLeditDependency(): void
$this->expectNotToPerformAssertions();
DependencyChecker::requireBernardLedit();
}

public function testBernardLeditVersionMatchesComposerConflict(): void
{
$composer = json_decode(file_get_contents(__DIR__ . '/../../composer.json'), true);
self::assertSame(
'<' . DependencyChecker::BERNARD_LEDIT_VERSION,
$composer['conflict']['ext-bernard_ledit']
);
}
}
Loading