* Modules, themes, and extensions * Publisher profiles and verification metadata * Installed-package tracking * Semantic version compatibility checks * PHP, Laravel, and Content Manager compatibility checks * Dependency resolution * SHA-256 checksum validation * Package signature requirements * Installation and update history * Enable and disable controls * Removal handling * Rollback records * Licence records * Marketplace administration UI * Authenticated REST endpoints * Console audit and synchronisation commands * Permissions and sidebar integration * Feature tests
18 lines
978 B
PHP
18 lines
978 B
PHP
<?php
|
|
namespace Modules\Marketplace\Services;
|
|
use Illuminate\Support\Facades\App;
|
|
final class CompatibilityChecker
|
|
{
|
|
public function __construct(private VersionConstraint $constraints=new VersionConstraint()) {}
|
|
public function check(array $manifest): array
|
|
{
|
|
$errors=[];
|
|
$php=(string)($manifest['php'] ?? '*'); $laravel=(string)($manifest['laravel'] ?? '*');
|
|
$platform=(string)($manifest['content_manager'] ?? '*'); $platformVersion=(string) config('app.version','1.0.0');
|
|
if (!$this->constraints->matches(PHP_VERSION,$php)) $errors[]="Requires PHP $php; running ".PHP_VERSION.'.';
|
|
if (!$this->constraints->matches(App::version(),$laravel)) $errors[]="Requires Laravel $laravel; running ".App::version().'.';
|
|
if (!$this->constraints->matches($platformVersion,$platform)) $errors[]="Requires Content Manager $platform; running $platformVersion.";
|
|
return ['compatible'=>$errors===[],'errors'=>$errors];
|
|
}
|
|
}
|