2017 © Pedro Peláez
 

cakephp-plugin cakephp3-aws-s3-datasource

AWS S3 datasource in CakePHP3

image

sters/cakephp3-aws-s3-datasource

AWS S3 datasource in CakePHP3

  • Saturday, May 12, 2018
  • by sters
  • Repository
  • 3 Watchers
  • 8 Stars
  • 2,199 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 6 % Grown

The README.md

CakePHP3 AWS S3 Datasource

CircleCI, (*1)

This CakePHP 3.0 plugin provides AWS S3 Datasource., (*2)

Installation

Install Plugin using composer., (*3)

$ composer require "sters/cakephp3-aws-s3-datasource:dev-master"

Add Plugin::load() on your config/bootstrap.php., (*4)

Plugin::load('CakeS3');

Add S3 Datasource on your config/app.php., (*5)

one Datasrouce has one S3 Bucket connection. You can not across bucket processing., (*6)

'Datasource' => [
    'my_s3_connection' => [
        'className'  => 'CakeS3\Datasource\Connection',
        'key'        => 'put your s3 access key',
        'secret'     => 'put your s3 access secret',
        'bucketName' => 'put your bucket name',
        'region'     => 'put your region',
    ],
],

Setup new table using s3 connection., (*7)

$_connectionName is your wrote connection name in config/app.php Datasource., (*8)

<?php
namespace App\Model\Table;

use CakeS3\Datasource\AwsS3Table;

class MyS3Table extends AwsS3Table
{
    protected static $_connectionName = 'my_s3_connection';
}

For example, declare action of get & show S3 Object., (*9)

class TopController extends Controller
{
    public function index()
    {
        $MyS3Table = TableRegistry::get('MyS3');
        $content = $MyS3Table->getObjectBody('/path/to/object/file.jpg');

        $this->response->type('image/jpeg');
        $this->response->body($content);

        return $this->response;
    }
}

Documentation

AwsS3Table support methods

The methods can call on your S3 Table., (*10)

If You want more detail, go to S3Client document. http://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.S3.S3Client.html, (*11)

copyObject(string $srcKey, string $destKey, array $options = []) : \Aws\Result

deleteObject(string $key, array $options = []) : \Aws\Result

deleteObjects(string $keys, array $options = []) : \Aws\Result

doesObjectExist(string $key, array $options = []) : bool

getObject(string $key, array $options = []) : \Aws\Result

headObject(string $key, array $options = []) : \Aws\Result

putObject(string $key, $content, array $options = []) : \Aws\Result

getObjectBody(string $key, array $options = []) : \GuzzleHttp\Psr7\Stream

moveObject(string $srcKey, string $destKey, array $options = []) : \Aws\Result

The Versions

12/05 2018

dev-master

9999999-dev https://github.com/sters/cakephp3-aws-s3-datasource

AWS S3 datasource in CakePHP3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar sters

s3 aws cakephp3 datasource

12/05 2018
12/05 2018

dev-fix-issue-2

dev-fix-issue-2 https://github.com/sters/cakephp3-aws-s3-datasource

AWS S3 datasource in CakePHP3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar sters

s3 aws cakephp3 datasource

15/12 2016
18/08 2016