I made a website in PHP around 1996, right after the birth of the thing itself, to replace some dirty C++ CGI scripts. That didn’t live for long, so I haven’t really done PHP in 24 (!) years.
Apparently, PHP now comes with a package manager called Composer. I put mine into /usr/local/bin.
Getting the AWS SDK for PHP
I made a new directory, and added the AWS SDK for PHP as a dependency.
This generated project, including a composer.json, and ran composer install, which downloaded dependencies and created a composer.lock file for future runs of composer install to maintain consistent versions.
Writing Code
All PHP code is within <?php ?> tags. The following example initializes the AWS SDK, creates an instance of a Data Exchange client, and lists entitled datasets.
Running the Sample
To run the sample, set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN and AWS_REGION.