packbackbooks / lti-1-3-php-library

A library used for building IMS-certified LTI 1.3 tool providers in PHP.
Apache License 2.0
39 stars 25 forks source link

Add PHP version requirement to composer.json #139

Closed danielTiringer closed 6 months ago

danielTiringer commented 6 months ago

Summary of Changes

The recently released version 6 contains changes that are only available since PHP 8.1, like initializing class variables in the constructor (see this RFC ). The code example below is from LtiMessageLaunch:

    public function __construct(
        private IDatabase $db,
        private ICache $cache,
        private ICookie $cookie,
        private ILtiServiceConnector $serviceConnector
    ) {
        $this->launch_id = uniqid('lti1p3_launch_', true);
    }

Having a php version designated in the composer.json throws an error if someone with an out-of-date php version attempts to require the package, providing an early warning that they wouldn't be able to use it due to the newer language constructs implemented.

Testing

dbhynds commented 6 months ago

I fixed the broken test already on master. Merging this in.

Thanks for contributing!

danielTiringer commented 6 months ago

Thank you too!