kiota icon indicating copy to clipboard operation
kiota copied to clipboard

PHP - Bump minimum supported version to PHP 8

Open Ndiritu opened this issue 2 years ago • 1 comments

Our Kiota lib currently supports a minimum of PHP 7.4 which is no longer in active support but will security updates until Nov '22

https://www.php.net/supported-versions.php

We should consider bumping our min. version to PHP 8 with the additional benefits of new features like built-in enums, named arguments, union types etc before GA.

Ndiritu avatar Apr 19 '22 19:04 Ndiritu

I'm looking into this now.

isvargasmsft avatar Sep 26 '22 19:09 isvargasmsft

@isvargasmsft Just a gentle reminder on this one. Since this last discussion 8 is out of active support (only security fixes) and 8.1 is active. It's going to be really hard for us to properly support customers if they are running on unsupported php engines. The new version would allow for a size reduction of the SDK. I believe this is something we should settle on quickly before we reach GA.

baywet avatar Nov 30 '22 18:11 baywet

Hi @baywet, thank you for the reminder.

My position is to upgrade to 8.1 and keep responding to the language.

Let's sync on the next stand up.

CC: @Ndiritu

isvargasmsft avatar Nov 30 '22 22:11 isvargasmsft

Adding to this... Latest stats on PHP versions from Packagist show that over 50% of apps have now upgraded to 8.x both from our package stats and the wider PHP ecosystem stats

Ndiritu avatar Dec 05 '22 08:12 Ndiritu

@MIchaelMainer guessing there might be compliance implications of building for an unsupported PHP version?

Ndiritu avatar Dec 05 '22 08:12 Ndiritu

I don't see a compliance issue with building for an unsupported version. With that said, we should start building for the latest supported version of PHP.

MIchaelMainer avatar Jan 06 '23 16:01 MIchaelMainer

Took a look at the new features PHP 8.0 provides that could improve our SDK experience but found that the value provided would be limited to warrant forcing developers to upgrade to PHP 8.

Some of the new features evaluated:

  • Constructor property promotion could reduce our SDK size by reducing the size of our models however with the use of the backing store, we have to set/get property values via setter/getter methods.
  • Named arguments would prove useful to improve discoverability of supported query parameters per request. This will be solved by adding constructors to the request config and query parameter classes and would work for both PHP 7 and PHP 8.
  • Built in Enum support would change our function declarations where union types are supported and validate the types at runtime, however we currently leverage PHP's loose typing and PHPDoc comments for methods that accept union types for arguments. With a PHPDoc comment like * @param $item string|int most IDEs make developers aware of the union type during autocompletion, while highlighting when wrong types are passed as arguments

With this, we have a better chance of covering a wider set of customers by shipping an SDK that works with both PHP 7 and PHP 8, leaving the choice to upgrade to developers.

Ndiritu avatar Feb 07 '23 07:02 Ndiritu