version_compare

Supported Versions: PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8
Compares two "PHP-standardized" version number strings
<?php version_compare(string $version1, string $version2, ?string $operator = null): int|bool
<?php     public static function rules()

    {

        if (version_compare(app()->version(), '8.43.0', '<')) {


            return 'min:8';

        }
<?php     public function handle()

    {

        if (version_compare(app()->version(), '7', '<')) {

            return $this->error('Laravel 7+ is required to install starter kits!');

        }
<?php             return true;

        }



        return version_compare($this->version, $this->latestVersion, '=');

    }



    public function license()
<?php {

    public function handler()

    {

        return version_compare(app()->version(), 7, '>=')

            ? ApiExceptionHandler::class

            : ApiExceptionHandlerForLaravelSix::class;

    }
<?php {

    public function handler()

    {

        return version_compare(app()->version(), 7, '>=')

            ? ControlPanelExceptionHandler::class

            : ControlPanelExceptionHandlerForLaravelSix::class;

    }
<?php     protected function isLicensed($version)

    {

        return version_compare($version, $this->addon->license()->versionLimit() ?? 999999, '<');

    }

}
<?php     protected function parseReleaseType($releaseVersion)

    {

        if (version_compare($releaseVersion, $this->currentVersion(), '=')) {

            return 'current';

        } elseif (version_compare($releaseVersion, $this->currentVersion(), '>')) {

            return 'upgrade';
<?php     {

        if (version_compare($releaseVersion, $this->currentVersion(), '=')) {

            return 'current';

        } elseif (version_compare($releaseVersion, $this->currentVersion(), '>')) {

            return 'upgrade';

        }
<?php         $newVersion = Lock::file()->getNormalizedInstalledVersion($this->package());

        $oldVersion = Lock::file(self::BACKUP_PATH)->getNormalizedInstalledVersion($this->package());



        return version_compare($version, $newVersion, '<=') && version_compare($version, $oldVersion, '>');

    }
<?php     public function additionalDataValues()

    {

        $lt7 = version_compare(app()->version(), 7, '<');



        return [

            'created_at' => $lt7 ? now()->format('Y-m-d H:i:s') : now()->toISOString(),
<?php         $testbench = (new \Statamic\Console\Processes\Composer(__DIR__.'/../../'))->installedVersion('orchestra/testbench-core');



        if (version_compare($testbench, '6.7.0', '<')) {

            $this->markTestSkipped('Need defineDatabaseMigrations method only introduced in 6.7.0');

        }

    }
<?php     {

        parent::setUp();



        if (version_compare(app()->version(), '7', '<')) {

            $this->markTestSkipped();

        }
<?php     public static function assertArraySubset($subset, $array, bool $checkForObjectIdentity = false, string $message = ''): void

    {

        $class = version_compare(app()->version(), 7, '>=') ? \Illuminate\Testing\Assert::class : \Illuminate\Foundation\Testing\Assert::class;

        $class::assertArraySubset($subset, $array, $checkForObjectIdentity, $message);

    }
<?php     private function addGqlMacros()

    {

        $testResponseClass = version_compare($this->app->version(), 7, '<')

            ? \Illuminate\Foundation\Testing\TestResponse::class

            : \Illuminate\Testing\TestResponse::class;