Installation guide
->method('listBuckets')
->will($this->returnValue(new Model(array(
'Buckets' => array(
array('Name' => 'foo'),
array('Name' => 'bar'),
array('Name' => 'baz')
)
))));
$this->serviceBuilder->set('s3', $mockS3Client);
// Test the FileBrowser object that uses the S3 client facade internally
$fileBrowser = new FileBrowser();
$partitions = $fileBrowser->getPartitions();
$this->assertEquals(array('foo', 'bar', 'baz'), $partitions);
}
}
Alternatively, if you are specifically only mocking responses from clients, you might consider using the Guzzle Mock
Plugin.
Performance Guide
The AWS SDK for PHP is able to send HTTP requests to various web services with minimal overhead. This
document serves as a guide that will help you to achieve optimal performance with the SDK.
Upgrade PHP 42
Use PHP 5.5 or an opcode cache like APC 42
Use Composer with a classmap autoloader 44
Uninstall Xdebug 44
Install PECL uri_template 44
Turn off parameter validation 44
Cache instance profile credentials 45
Check if you are being throttled 45
Preload frequently included files 45
Profile your code to find performance bottlenecks 46
Comparing SDK1 and SDK2 46
Upgrade PHP
Using an up-to-date version of PHP will generally improve the performance of your PHP applications. Did you know
that PHP 5.4 is 20-40% faster than PHP 5.3? Upgrading to PHP 5.4 or greater will provide better performance and
lower memory usage. If you cannot upgrade from PHP 5.3 to PHP 5.4 or PHP 5.5, upgrading to PHP 5.3.18 or
greater will improve performance over older versions of PHP 5.3.
You can install PHP 5.4 on an Amazon Linux AMI using the following command.
yum install php54
Use PHP 5.5 or an opcode cache like APC
To improve the overall performance of your PHP environment, it is highly recommended that you use an opcode
cache such as the OPCache built into PHP 5.5, APC, XCache, or WinCache. By default, PHP must load a file from
disk, parse the PHP code into opcodes, and finally execute the opcodes. Installing an opcode cache allows the
parsed opcodes to be cached in memory so that you do not need to parse the script on every web server request,
and in ideal circumstances, these opcodes can be served directly from memory.
Performance Guide
42