k_mada
k_mada

Reputation: 151

AWS PHP SDK - Loading only what I need

I am looking to use the AWS PHP SDK to handle some signed URLs for S3, per this article:

http://ceph.com/docs/next/radosgw/s3/php/

However, when I downloaded the SDK, it's huge. It's 9.6MB and over 1,000 files. Do I really need to copy all of those files to my server, or can I somehow customize my usage of the SDK to only load the parts I need to use S3? I don't have a lot of control over our production servers, so any solution that requires me to run some sort of tool/framework on a server might not be feasible for me.

Upvotes: 2

Views: 170

Answers (3)

giaour
giaour

Reputation: 4071

You might actually need to use v2 of the SDK, as Ceph might not support the new S3 authentication protocol used in v3. (The examples shown on the link you provided actually use v2 of the SDK, but v2 should still work.)

v2 is actually larger than v3 by several megabytes, but if you follow Mark Baker's suggestion to use the phar or deploy via composer, then you won't need to wait for 1,000+ to finish rsync-ing/scp-ing/sftp-ing.

Upvotes: 0

Basti
Basti

Reputation: 4042

I'm pretty sure you don't have to upload those files you don't need. To get a list of the files you actually used you could:

  • write a script doing some URL signing for you
  • at the end of the script call get_included_files to get a list of files the autoloader included
  • only copy those files to your production server

This may cause problems when something happens differently and other classes you previously didn't use a tried to be loaded. I'd therefore be generous and include whole feature folders if one of the files was included before. For example I'd upload the whole vendor/guzzlehttp folder even if you didn't include all of it's files.

Upvotes: 0

Mark Baker
Mark Baker

Reputation: 212412

It should also be available as a single .phar file (which includes all the dependencies of the SDL as well) - easier to copy one file than many - Installing via phar

Upvotes: 3

Related Questions