PHP code example of kdaviesnz / bucketlist

1. Go to this page and download the library: Download kdaviesnz/bucketlist library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kdaviesnz / bucketlist example snippets

 php
        $region = '*******'; // eg 'ap-southeast-2'
        $key = '*******'; // your amazon credential key
        $secret = '********'; // your amazon credential secret.

        $bucketlist = new \kdaviesnz\bucketlist\Bucketlist($region, $key, $secret);

        // Fetch buckets
        $result = $bucketlist->fetch('');

        // Fetch buckets using a filter
        $filter = function(array $objects) {
            return array_filter(
                $objects,
                function($object) {
                    return $object['Name'][0] == "a";
                }
            );
        };
        $result = $bucketlist->fetch('', $filter);

        // Fetch objects from a bucket
        $result = $bucketlist->fetch("yourbucketname");

        // Fetch objects from a bucket using a filter
        $filter = function(array $objects) {
            return $movies = array_filter(
                $objects,
                function($object){
                    $temp = explode(".", trim($object['Key']));
                    return $temp[count($temp)-1] == "mp4";
                });
        };
        $result = $bucketlist->fetch("yourbucketname", $filter);