jlevers / selling-partner-api

A PHP client library for Amazon's Selling Partner API
BSD 3-Clause "New" or "Revised" License
398 stars 185 forks source link

Compatibility with PHP 7.4 #785

Closed nanamiae closed 1 day ago

nanamiae commented 6 days ago

Problem description:

I was wondering how complicated it is to make the repository compatible with PHP 7.4. If you plan to, by chance, maybe make backwars compatibility?

The current version (7.1.0), I wanted to know how in-depth the changes would have to be, and if I try to do so, I'd lose the whole project in itself (developing an app with your repository).

If not that, I was wondering, the last version that was compatible, at the least, with 7.4 was v5.10.2. Can I take advantage of the code in more recent versions? More specifically, establishing the connection, like with this bit:

Code1

use SellingPartnerApi\Enums\Endpoint;

$connector = SellingPartnerApi::seller(
    clientId: 'amzn1.application-oa2-client.asdfqwertyuiop...',
    clientSecret: 'amzn1.oa2-cs.v1.1234567890asdfghjkl...',
    refreshToken: 'Atzr|IwEBIA...',
    endpoint: Endpoint::NA,  // Or Endpoint::EU, Endpoint::FE, Endpoint::NA_SANDBOX, etc.
);

Instead of this:

Code2

    "lwaClientId" => "<LWA client ID>",
    "lwaClientSecret" => "<LWA client secret>",
    "lwaRefreshToken" => "<LWA refresh token>",
    "awsAccessKeyId" => "<AWS access key ID>",
    "awsSecretAccessKey" => "<AWS secret access key>",
    // If you're not working in the North American marketplace, change
    // this to another endpoint from lib/Endpoint.php
    "endpoint" => SellingPartnerApi\Endpoint::NA,
]);

Sorry for the lack of expertise. I am quite new to the whole Amazon, web services, and PHP in itself.

jlevers commented 1 day ago

Hey @nanamiae – that would be very, very complicated unfortunately :) v7 is generated in such a way that it is only compatible with newer versions of PHP, so the entire library would have to be reworked. Sorry about that!