Closed discover59 closed 3 years ago
The ConfigurationOptions
object was removed in v3 of this library. The Configuration
object now just accepts an array of options -- check out the README for details.
@jlevers What's the best way to use dynamic refresh token with same other information?
I would store the static info in environment variables using something like vlucas/phpdotenv, and then load those environment variables into the Configuration
constructor.
Hmm, this is not comfortable compared to other libraries I used for MWS.
MWS was a much simpler system than the SP API.
I originally set up this library to load config info from environment variables by default, but the very first issue someone opened (#1) was a request to leave the environment setup to the user. I thought that was a good point, so I've since changed the library to be more configurable, at the expense of requiring a little more setup for certain use cases.
Using this library with your your own env vars would require installing the package I linked, creating a .env
file, and loading the variables in that file into a function or factory class that produces Configuration
objects (a couple lines of code).
If you have suggestions for a different way this should work, I'm open to hearing them :)
I am using .env already, but the case is for multiple sellers and I have to update refresh token and region in the loop of operation. I don't want to include other redundant variables in the loop. That's why I prefer the configuration object updatable by different setters.
https://github.com/clousale/amazon-sp-api-php
Above library does it.
If something as simple as getters and setters for the configuration options would solve the issue you're having, I'm happy to make that change. I'll try to get that done in the next couple weeks.
@discover59, those getters and setters have been added in v3.1.4.
I prefer to use dynamic ConfigurationOptions for dynamic sellers and pass it to Configuration. But it doesn't accept that type which is confusing.
Please let me know what I can use for this purpose.