<?php

declare(strict_types=1);

$min = '8.2.0';

if (version_compare(PHP_VERSION, $min, '<')) {
    fwrite(STDERR, PHP_EOL);
    fwrite(STDERR, "Composer blocked: this project requires PHP {$min}+ (Laravel 11 / Filament).".PHP_EOL);
    fwrite(STDERR, 'Your PHP version: '.PHP_VERSION.PHP_EOL.PHP_EOL);
    fwrite(STDERR, 'Fix (Windows): install PHP 8.2 or 8.3, then point this terminal at it:'.PHP_EOL);
    fwrite(STDERR, '  - Laravel Herd: https://herd.laravel.com/windows'.PHP_EOL);
    fwrite(STDERR, '  - Laragon: Menu → PHP → pick 8.2+'.PHP_EOL);
    fwrite(STDERR, '  - WAMP: install a PHP 8.2+ build and add its folder to PATH (or use full path to php.exe)'.PHP_EOL.PHP_EOL);
    fwrite(STDERR, 'Then run: php -v   (must show 8.2+)   and   composer install'.PHP_EOL.PHP_EOL);

    exit(1);
}
