Giter Site home page Giter Site logo

aws / aws-sdk-php-zf2 Goto Github PK

View Code? Open in Web Editor NEW
102.0 44.0 73.0 154 KB

ZF2 module for using the AWS SDK for PHP to interact with AWS services like S3, DynamoDB, SQS, EC2, etc.

Home Page: http://aws.amazon.com/sdkforphp/

License: Apache License 2.0

PHP 97.60% Makefile 2.40%

aws-sdk-php-zf2's Introduction

AWS SDK ZF2 Module

Latest Stable Version Total Downloads Build Status

This module provides a simple wrapper for the AWS SDK for PHP. It registers the AWS service builder as a service in the ZF2 service manager, making it easily accessible anywhere in your application.

Jump To:

Getting Started

Installation

Install the module using Composer into your application's vendor directory. Add the following line to your composer.json. This will also install the AWS SDK for PHP.

If you want to use ZF3 and your PHP version >= 5.6, use

{
    "require": {
        "aws/aws-sdk-php-zf2": "4.*"
    }
}

Otherwise,

{
    "require": {
        "aws/aws-sdk-php-zf2": "3.*"
    }
}

If you are using ZF2 service manager < 2.7, please use the 2.0.* version.

If you are using AWS SDK v2, please use the 1.2.* version of the ZF2 module.

Configuration

Add the module name to your project's config/application.config.php or config/modules.config.php:

return array(
    /* ... */
    'modules' => array(
        /* ... */
        'AwsModule'
    ),
    /* ... */
);

Copy and paste the aws.local.php.dist file to your config/autoload folder and customize it with your credentials and other configuration settings. Make sure to remove .dist from your file. Your aws.local.php might look something like the following:

<?php

return [
    'aws' => [
        'credentials' => [
            'key'    => '<your-aws-access-key-id>',
            'secret' => '<your-aws-secret-access-key>',
        ]
        'region' => 'us-west-2'
    ]
];

NOTE: If you are using IAM Instance Profile credentials (also referred to as IAM Roles for instances), you can omit your key and secret parameters since they will be fetched from the Amazon EC2 instance automatically.

Usage

You can get the AWS service builder object from anywhere that the ZF2 service locator is available (e.g. controller classes). The following example instantiates an Amazon DynamoDB client and creates a table in DynamoDB.

use Aws\Sdk;

public function indexAction()
{
    $aws    = $this->getServiceLocator()->get(Sdk::class);
    $client = $aws->createDynamoDb();

    $table = 'posts';

    // Create a "posts" table
    $result = $client->createTable(array(
        'TableName' => $table,
        'KeySchema' => array(
            'HashKeyElement' => array(
                'AttributeName' => 'slug',
                'AttributeType' => 'S'
            )
        ),
        'ProvisionedThroughput' => array(
            'ReadCapacityUnits'  => 10,
            'WriteCapacityUnits' => 5
        )
    ));

    // Wait until the table is created and active
    $client->waitUntilTableExists(array('TableName' => $table));

    echo "The {$table} table has been created.\n";
}

View Helpers

The AWS SDK ZF2 Module now provides two view helpers to generate links for Amazon S3 and Amazon CloudFront resources.

Note: Starting from v2 of the AWS module, all URLs for both S3 and CloudFront are using HTTPS and this cannot be modified.

S3Link View Helper

To create a S3 link in your view:

<?php echo $this->s3Link('my-object', 'my-bucket');

The default bucket can be set globally by using the setDefaultBucket method:

<?php
    $this->plugin('s3Link')->setDefaultBucket('my-bucket');
    echo $this->s3Link('my-object');

You can also create signed URLs for private content by passing a third argument which is the expiration date:

<?php echo $this->s3Link('my-object', 'my-bucket', '+10 minutes');

CloudFrontLink View Helper

To create CloudFront link in your view:

<?php echo $this->cloudFrontLink('my-object', 'my-domain');

The default domain can be set globally by using the setDefaultDomain method:

<?php
    $this->plugin('cloudFrontLink')->setDefaultDomain('my-domain');
    echo $this->cloudFrontLink('my-object');

You can also create signed URLs for private content by passing a third argument which is the expiration date:

<?php echo $this->cloudFrontLink('my-object', 'my-bucket', time() + 60);

Filters

The AWS SDK ZF2 module provides a simple file filter that allow to directly upload to S3. The S3RenameUpload extends RenameUpload class, so please refer to its documentation for available options.

This filter only adds one option to set the bucket name (through the setBucket method, or by passing a bucket key to the filter's setOptions method).

$request = new Request();
$files   = $request->getFiles();
// e.g., $files['my-upload']['tmp_name'] === '/tmp/php5Wx0aJ'
// e.g., $files['my-upload']['name'] === 'profile-picture.jpg'

// Fetch the filter from the Filter Plugin Manager to automatically handle dependencies
$filter = $serviceLocator->get('FilterManager')->get('S3RenameUpload');

$filter->setOptions(’[
    'bucket'    => 'my-bucket',
    'target'    => 'users/5/profile-picture.jpg',
    'overwrite' => true
]);

$filter->filter($files['my-upload']);

// File has been renamed and moved to 'my-bucket' bucket, inside the 'users/5' path

Session Save Handlers

Read the [session save handler section] (http://zf2.readthedocs.org/en/latest/modules/zend.session.save-handler.html) in the ZF2 documentation for more information.

DynamoDB

To follow the [ZF2 examples] (http://zf2.readthedocs.org/en/latest/modules/zend.session.save-handler.html), the DynamoDB session save handler might be used like this:

use AwsModule\Session\SaveHandler\DynamoDb as DynamoDbSaveHandler;
use Laminas\Session\SessionManager;

// Assume we are in a context where $serviceLocator is a ZF2 service locator.

$saveHandler = $serviceLocator->get(DynamoDbSaveHandler::class);

$manager = new SessionManager();
$manager->setSaveHandler($saveHandler);

You will probably want to further configure the save handler, which you can do in your application. You can copy the config/aws_zf2.local.php.dist file into your project's config/autoload directory (without the .dist of course).

See config/aws_zf2.local.php.dist and [the AWS session handler documentation] (http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.DynamoDb.Session.SessionHandler.html#_factory) for more detailed configuration information.

Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.

This SDK implements AWS service APIs. For general issues regarding the AWS services and their limitations, you may also take a look at the Amazon Web Services Discussion Forums.

Opening Issues

If you encounter a bug with aws-sdk-php-zf2 we would like to hear about it. Search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of aws-sdk-php-zf2, PHP version and OS you’re using. Please include a stack trace and reduced repro case when appropriate, too.

The GitHub issues are intended for bug reports and feature requests. For help and questions with using aws-sdk-php please make use of the resources listed in the Getting Help section. There are limited resources available for handling issues and by keeping the list of open issues lean we can respond in a timely manner.

Contributing

We work hard to provide a high-quality and useful SDK for our AWS services, and we greatly value feedback and contributions from our community. Please review our contributing guidelines before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.

Related Modules

The following are some ZF2 modules that use the AWS SDK for PHP by including this module:

  • SlmMail - Module that allow to send emails with various providers (including Amazon SES)
  • SlmQueueSqs – Module that simplifies the use of Amazon SQS

Resources

aws-sdk-php-zf2's People

Contributors

ajredniwja avatar alexdenvir avatar almost-online avatar bakura10 avatar basz avatar cjyclaire avatar datasage avatar diehlaws avatar evandotpro avatar firelike avatar gws avatar howardlopez avatar jeremeamia avatar jeskew avatar jguittard avatar kellertk avatar kstich avatar lansoweb avatar samsonasik avatar snapshotpl avatar somayab avatar vincequeiroz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sdk-php-zf2's Issues

v3 is not compatible with zendframework/zend-filter

Version of AWS SDK for PHP?

3.133.6

Version of AWS SDK ZF2 Module?

3.0.0

Version of ZF2?

"zendframework/zend-mvc": "~2.6.0",
"zendframework/zend-servicemanager": "~2.7.0",

Version of PHP (php -v)?

7.1

What issue did you see?

When using the S3RenameUpload-Filter I get a warning saying:
"Warning: Declaration of AwsModule\Filter\File\S3RenameUpload::getFinalTarget($uploadData) should be compatible with Zend\Filter\File\RenameUpload::getFinalTarget($source, $clientFileName) in /platform/vendor/aws/aws-sdk-php-zf2/src/Filter/File/S3RenameUpload.php on line 12"

This ZF-change was introduced in zendframework/zend-filter@f97d416 - which was released with v.2.9.0 of "zendframework/zend-filter"

How would I use the s3link in a layout?

Hi,

Good day.

This seems to work for ZF2 but not ZF3. If I try and use:

$this->plugin('s3Link')->setDefaultBucket($bucket);

In the main view layout, I get the following error:

Fatal error: Uncaught Zend\ServiceManager\Exception\ServiceNotFoundException: A plugin by the name "s3Link" was not found in the plugin manager Zend\View\HelperPluginManager in /var/www/html/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php on line 131

I'm using v4 of this module so it should work with ZF3. Thanks.

Regards.
JJ

Conflict with DIRECTORY_SEPARATOR in S3RenameUpload

Well, i'm using windows and i have some problems when i tried to put an object in my s3 bucket.
For example, i have this file:
/96/40/75/9640759a4b7e2a9aca8ee8f377af0740.png

But in muy bucket, this file its wrong
/96/40/75\9640759a4b7e2a9aca8ee8f377af0740.png

if you add this fix , i think we solve the problem.

protected function getFinalTarget($uploadData)
{
// We cannot upload without a bucket
if (null === $this->options['bucket']) {
throw new MissingBucketException('No bucket was set when trying to upload a file to S3');
}

    $target = parent::getFinalTarget($uploadData);

    // begin fix
    if(DIRECTORY_SEPARATOR != '/'){
        $target = str_replace(DIRECTORY_SEPARATOR, '/', $target);
    }
    // end fix

    return sprintf('s3://%s/%s', $this->options['bucket'], trim($target, '/'));
}

ZF2 Skeleton Integration

Hi Jeremy! How are you?

Please, I am a Zend Framework newbie, how can I integrate this module with Zend Skeleton for example? The directory Structure of this module is a little bit different from ZF2 Skeleton.

Thanks in advice!

$sm->get(DynamoDbSaveHandler::class); i got a error

i'm working with zend2. when i try to call on Module.php (getServiceConfig function)

$saveHandler = $sm->get(DynamoDbSaveHandler::class); i got a error

Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for AwsModule\Session\SaveHandler\DynamoDb ...............

can you help me ?

problem serviceLocator S3RenameUpload

In this line:

$filter = $this->getServiceLocator()->get('FilterManager')->get('S3RenameUpload');

I got this error:

An exception was raised while creating "S3RenameUpload"; no instance returned

Someone can help me!?

ACL Object from S3RenameUpload

Hello,

I'm using Filter S3RenameUpload to send my files in my server AWS S3. Sent correctly, but, don't know how to set ACL as public-read, it's possible?

Generating incorrect upload URL

Upgraded to version 2 and updated config and code accordingly. Now it is generating incorrect URL (note the double dots after s3(..) in error message)

Exception details:

Aws\S3\Exception\S3Exception

File:

\MyProject\vendor\aws\aws-sdk-php\src\WrappedHttpHandler.php:159

Message:

Error executing "PutObject" on "https://s3..amazonaws.com/my-bucket/files/xxxxxx.txt"; AWS HTTP error: cURL error 6: Could not resolve host: s3..amazonaws.com (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Stack trace:

#0 \MyProject\vendor\aws\aws-sdk-php\src\WrappedHttpHandler.php(77): Aws\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\Psr7\Request), Object(Aws\Command))
#1 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(199): Aws\WrappedHttpHandler->Aws{closure}(Array)
#2 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(170): GuzzleHttp\Promise\Promise::callHandler(2, Array, Array)
#3 \MyProject\vendor\guzzlehttp\promises\src\RejectedPromise.php(40): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}(Array)
#4 \MyProject\vendor\guzzlehttp\promises\src\TaskQueue.php(60): GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise{closure}()
#5 \MyProject\vendor\guzzlehttp\guzzle\src\Handler\CurlMultiHandler.php(96): GuzzleHttp\Promise\TaskQueue->run()
#6 \MyProject\vendor\guzzlehttp\guzzle\src\Handler\CurlMultiHandler.php(123): GuzzleHttp\Handler\CurlMultiHandler->tick()
#7 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(240): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#8 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(217): GuzzleHttp\Promise\Promise->invokeWaitFn()
#9 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(261): GuzzleHttp\Promise\Promise->waitIfPending()
#10 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(219): GuzzleHttp\Promise\Promise->invokeWaitList()
#11 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(261): GuzzleHttp\Promise\Promise->waitIfPending()
#12 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(219): GuzzleHttp\Promise\Promise->invokeWaitList()
#13 \MyProject\vendor\guzzlehttp\promises\src\Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#14 \MyProject\vendor\aws\aws-sdk-php\src\AwsClient.php(202): GuzzleHttp\Promise\Promise->wait()
#15 \MyProject\vendor\aws\aws-sdk-php\src\AwsClient.php(167): Aws\AwsClient->execute(Object(Aws\Command))
#16 \MyProject\module\Application\src\Application\Model\Mymodule.php(377): Aws\AwsClient->__call('putObject', Array)
#17 \MyProject\module\Mymodule\src\Mymodule\Controller\MymoduleController.php(20): Application\Model\Mymodule->uploadToS3('files/x...')
#18 \MyProject\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(82): Mymodule\Controller\MymoduleController->indexAction()
#19 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#20 \MyProject\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#21 \MyProject\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#22 \MyProject\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#23 \MyProject\vendor\zendframework\zend-mvc\src\DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#24 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#25 \MyProject\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#26 \MyProject\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#27 \MyProject\vendor\zendframework\zend-mvc\src\Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#28 \MyProject\public\index.php(96): Zend\Mvc\Application->run()
#29 {main}

Hello

Is this related to a problem?

A clear and concise description of the issue, e.g. I'm always frustrated when...

Feature description

Describe what you want to happen.

Describe alternatives you've considered

Any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

PHP Fatal error - version 2.0.2

Hi guys,
since the release of your version 2.0.2 i am getting the following PHP Fatal error

PHP Fatal error: Uncaught TypeError: Argument 1 passed to AwsModule\Factory\AwsFactory::__invoke() must be an instance of Interop\Container\ContainerInterface, instance of Zend\ServiceManager\ServiceManager given, called in /Applications/MAMP/htdocs/XXXXX/vendor/aws/aws-sdk-php-zf2/src/Factory/AwsFactory.php on line 44 and defined in /Applications/MAMP/htdocs/XXXXX/vendor/aws/aws-sdk-php-zf2/src/Factory/AwsFactory.php:23

How i try to get for example my S3Client:

/**
 * @return \Aws\S3\S3Client
 */
private function getS3Client()
{
    /** @var Sdk $aws */
    $aws = $this->getServiceLocator()->get(Sdk::class);

    return $aws->createS3();
}

Why is such a change not a Breaking Change which ends in a new minor version (2.1.0)?

best regards
Maik

S3 signature

Hi,

I've tried to make CORS for S3 work in my application. This thing needs our server to sign requests. The problem is that SignatureInterface (https://github.com/aws/aws-sdk-php/blob/master/src/Aws/Common/Signature/SignatureInterface.php) is bound to a Guzzle Request Interface, therefore I could not write an adapter for Zend Framework Request object.

The only solution I've found so far is to convert a Zend Request to a Guzzle Request, sign the Guzzle Request.

What is your position on that @jeremeamia ? (I suppose you already had this problem with Symfony 2 bundle).

That kind of cases really want to to have a PSR interface for HTTP (php-fig/fig-standards#72).

got exception when trying to create an S3 class according to the readme

$aws = $this->getServiceLocator()->get(Aws::class);
$s3 = $aws->create('S3');

results in

Catchable fatal error: Argument 2 passed to Aws\Sdk::createClient() must be of the type array, string given, called in /var/www/dev.hub/vendor/aws/aws-sdk-php/src/Sdk.php on line 85 and defined in /var/www/dev.hub/vendor/aws/aws-sdk-php/src/Sdk.php on line 102
Call Stack
#   Time    Memory  Function    Location
1   0.0000  244600  {main}( )   .../index.php:0
2   0.0343  2725840 Zend\Mvc\Application->run( )    .../index.php:17
3   0.0353  2748128 Zend\EventManager\EventManager->trigger( )  .../Application.php:314
4   0.0353  2748128 Zend\EventManager\EventManager->triggerListeners( ) .../EventManager.php:205
5   0.0354  2749888 call_user_func:{/var/www/dev.hub/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:444} ( ) .../EventManager.php:444
6   0.0354  2750384 Zend\Mvc\DispatchListener->onDispatch( )    .../EventManager.php:444
7   0.0363  2837928 Zend\Mvc\Controller\AbstractController->dispatch( ) .../DispatchListener.php:93
8   0.0363  2838392 Zend\EventManager\EventManager->trigger( )  .../AbstractController.php:118
9   0.0364  2838392 Zend\EventManager\EventManager->triggerListeners( ) .../EventManager.php:205
10  0.0377  3023464 call_user_func:{/var/www/dev.hub/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:444} ( ) .../EventManager.php:444
11  0.0377  3023592 Zend\Mvc\Controller\AbstractActionController->onDispatch( ) .../EventManager.php:444
12  0.0377  3023936 DataSystems\Controller\HooplaController->uploadAction( )    .../AbstractActionController.php:82
13  0.0392  3129432 create ( )  .../HooplaController.php:70
14  0.0392  3129840 Aws\Sdk->__call( )  .../HooplaController.php:70
15  0.0392  3129928 Aws\Sdk->createClient( )

module not working ...

Hi,

I have installed the module but not via composer i simply download it and copy it to my vendor folder also downloaded the guzzle and the AWS SDK however everything stops when i try to use it, and it stops right after this line

$aws = $this->getServiceLocator()->get('Aws');

no error message just this generic one:

An error occurred
An error occurred during execution; please try again later.

P.S. i have also renamed the directory from aws-sdk-php-zf2 to simply aws

if anyone has an idea of what would may be i would really appreciate a little help, thx! :)

ZF3 support

Hi,

Good day, and thanks for the cool module.

Any plans to port to ZF3? Thanks.

Zend Framework 3.0 support

With the recent release of Zend Framework 3.0 this library no longer supports a compatible repository list. That is, with this module as a dependency it is not possible to install Zend Framework 3.0. This is an issue for my ability to develop into the future.

This library will no longer represent its name. However the latest release remarked support for 3.0 was now included.

I recommend you retire this module to Zend Framework 2 and create a new module called aws-sdk-php-zendframework to support the development of Zend Framework going forward.

Please consider this a high priority so we can start using the latest from Zend with the latest from AWS.

v4 is not compatible with zend-servicemanager ^2.7.0

Please fill out the sections below to help us address your issue.

Version of AWS SDK for PHP?

3.87.20

Version of AWS SDK ZF2 Module?

v4.1.0

Version of ZF2?

2

Version of PHP (php -v)?

7.1.33

What issue did you see?

Fatal error: Interface 'Zend\ServiceManager\Factory\FactoryInterface' not found in /var/www/vendor/aws/aws-sdk-php-zf2/src/Factory/DynamoDbSessionSaveHandlerFactory.php on line 16

Steps to reproduce

If you have a runnable example, please include it as a snippet or link to a repository/gist for larger code examples.

Additional context

Any additional information relevant to the issue, for example PHP/environment config settings if the issue is related to memory or performance.
Using zendframework/zend-servicemanager 2.7.11, which is supposed to be supported from reading the composer.json file

master branch is incompatible with ZF2

The change made in #36 to the AwsModule\Factory\AwsFactory class is incompatible with ZF2 as the ZF2 Service Manager isn't an instance of Interop\Container\ContainerInterface

Compatibility with ZF2 2.3

Good day everybody,

Seems like the latest version of Zend 2.3, specifically changes centering around the Translator Interfaces, breaks some of this code.

As a workaround, in my own projects, I made the following changes to vendor/zendframework/zend-view/Zend/View/Helper/HeadTitle.php and vendor/zendframework/zend-view/Zend/View/Helper/Navigation/AbstractHelper.php:

/** Added this import */
use Zend\I18n\Translator\TranslatorInterface;

/** And changed TypeHint to TranslatorInterface (imported above) */
public function setTranslator(TranslatorInterface $translator = null, $textDomain = null)

I don't know if this is perfect, but I thought I would at least share my experience with you guys.

Thanks!

James Colestock
[email protected]

Release version 4.2

The version constraint for zend-filter was updated in this commit f839122. However a release has not been tagged since then and as a result I cannot use zend-filter version 2.9 in my application alongside this library.

$this->s3Link doesn't exist in view

Hello.
I'm writing a PHP application with zend framework 2.4.0dev
PHP version 5.5.12

I used composer to install the aws-sdk-php-zf2 module and I add Aws to the application.config.php under modules.

in views I don't have $this->s3Link. am i missing something ?

my composer.json has the following:
"aws/aws-sdk-php-zf2": "1.2.*"

which means it should install the latest version that already has this feature.

Support for multiple regions

I can't seem to find the documentation to specify regions in the module configurations for different services. I use Sydney (ap-southeast-2) for all services such as EC2 & S3. I use Ireland for SES (eu-west-1).

I tried the following, but that didn't work either

return array(
    'aws' => array(
        'key'    => '',
        'secret' => '',

        'services' => array(
            'ses' => array(
                'params' => array(
                    'region' => 'eu-west-1'
                )
            ),
            's3' => array(
                'params' => array(
                    'region' => 'ap-southeast-2'
                )
            ),
        )
    )
);

How to use Module?

Hi everyone, i read and did follow ReadMe document:

  1. use composer to get module

  2. create table to save session from amazon console.

  3. copy and change config key, secret, region, table_name in aws.local.php

  4. in application.config.php i added:
    return array(
    'modules' => array(
    'Aws',
    ),
    (and so on)

  5. in Module.php:
    public function onBootstrap(MvcEvent $e)
    {
    $eventManager = $e->getApplication()->getEventManager();
    $moduleRouteListener = new ModuleRouteListener();
    $moduleRouteListener->attach($eventManager);

    $saveHandler = $e->getApplication()->getServiceManager()->get('Aws\Session\SaveHandler\DynamoDb');
    $sessionManager = new SessionManager();
    $sessionManager->setSaveHandler($saveHandler);
    $sessionManager->start();
    Container::setDefaultManager($sessionManager);
    

    }
    ......

  6. in Controller Action i use session:
    $this->userSession = new Container('default');
    //set session
    $this->userSession->offsetSet('user','Tony');

//get session:
return $this->userSession->offsetGet('user');

But it not work at all, session not be save. Please help me to discuss my mistake ?
Thanks all !

ServiceNotCreatedException

$filter = $this->getServiceLocator()->get('FilterManager')->get('S3RenameUpload');

An exception was raised while creating "S3RenameUpload"; no instance returned

Can some please help?

PHP 8 support?

Describe the feature

Hi,

Good day.

Will this module have PHP 8 support? Thanks.

Regards,
Jarrett

Use Case

N/A

Proposed Solution

No response

Other Information

Error:
Screenshot 2023-09-11 at 11 28 17

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

4*

Environment details (OS name and version, etc.)

Ubuntu

Upload to S3 Bucket (S3RenameUpload) question

I'm fairly new to ZF2 so thanks in advance if you can help.

I using this module in a controller:

$serviceLocator = $this->getServiceLocator()->get('aws');
$filter = $serviceLocator->get('FilterManager')->get('S3RenameUpload');

Do I need to register/use another module or service?

-Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.