Skip to content

Commit

Permalink
Merge pull request #1 from rudolfkrupa/hyperia
Browse files Browse the repository at this point in the history
hyperia
  • Loading branch information
karster authored Jan 5, 2022
2 parents fd7bb53 + 728a533 commit 099a561
Show file tree
Hide file tree
Showing 36 changed files with 214 additions and 216 deletions.
35 changes: 14 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@

An Amazon S3 component for Yii2.

[![License](https://poser.pugx.org/frostealth/yii2-aws-s3/license)](https://github.com/frostealth/yii2-aws-s3/blob/2.x/LICENSE)
[![Latest Stable Version](https://poser.pugx.org/frostealth/yii2-aws-s3/v/stable)](https://packagist.org/packages/frostealth/yii2-aws-s3)
[![Total Downloads](https://poser.pugx.org/frostealth/yii2-aws-s3/downloads)](https://packagist.org/packages/frostealth/yii2-aws-s3)
[![Latest Unstable Version](https://poser.pugx.org/frostealth/yii2-aws-s3/v/unstable)](https://packagist.org/packages/frostealth/yii2-aws-s3)

> Yii2 AWS S3 uses [SemVer](http://semver.org/).
> Version 2.x requires PHP 7. For PHP less 7.0 use [1.x](https://github.com/frostealth/yii2-aws-s3/tree/1.x).
## Installation

1. Run the [Composer](http://getcomposer.org/download/) command to install the latest version:

```bash
composer require frostealth/yii2-aws-s3 ~2.0
composer require hyperia/yii2-aws-s3 ~2.0
```

2. Add the component to `config/main.php`
Expand All @@ -25,7 +18,7 @@ An Amazon S3 component for Yii2.
'components' => [
// ...
's3' => [
'class' => 'frostealth\yii2\aws\s3\Service',
'class' => 'hyperia\yii2\aws\s3\Service',
'credentials' => [ // Aws\Credentials\CredentialsInterface|array|callable
'key' => 'my-key',
'secret' => 'my-secret',
Expand All @@ -43,7 +36,7 @@ An Amazon S3 component for Yii2.
### Usage of the command factory and additional params

```php
/** @var \frostealth\yii2\aws\s3\Service $s3 */
/** @var \hyperia\yii2\aws\s3\Service $s3 */
$s3 = Yii::$app->get('s3');
/** @var \Aws\ResultInterface $result */
Expand Down Expand Up @@ -72,7 +65,7 @@ $signedUrl = $s3->commands()->getPresignedUrl('filename.ext', '+2 days')->execut
### Short syntax
```php
/** @var \frostealth\yii2\aws\s3\Service $s3 */
/** @var \hyperia\yii2\aws\s3\Service $s3 */
$s3 = Yii::$app->get('s3');
/** @var \Aws\ResultInterface $result */
Expand Down Expand Up @@ -101,7 +94,7 @@ $signedUrl = $s3->getPresignedUrl('filename.ext', '+2 days');
### Asynchronous execution
```php
/** @var \frostealth\yii2\aws\s3\Service $s3 */
/** @var \hyperia\yii2\aws\s3\Service $s3 */
$s3 = Yii::$app->get('s3');
/** @var \GuzzleHttp\Promise\PromiseInterface $promise */
Expand All @@ -119,10 +112,10 @@ $promise = $s3->commands()->list('path/')->async()->execute();
## Advanced usage
```php
/** @var \frostealth\yii2\aws\s3\interfaces\Service $s3 */
/** @var \hyperia\yii2\aws\s3\interfaces\Service $s3 */
$s3 = Yii::$app->get('s3');
/** @var \frostealth\yii2\aws\s3\commands\GetCommand $command */
/** @var \hyperia\yii2\aws\s3\commands\GetCommand $command */
$command = $s3->create(GetCommand::class);
$command->inBucket('my-another-bucket')->byFilename('filename.ext')->saveAs('/path/to/local/file.ext');
Expand Down Expand Up @@ -158,9 +151,9 @@ Consider the following command:
namespace app\components\s3\commands;
use frostealth\yii2\aws\s3\base\commands\traits\Options;
use frostealth\yii2\aws\s3\interfaces\commands\Command;
use frostealth\yii2\aws\s3\interfaces\commands\HasBucket;
use hyperia\yii2\aws\s3\base\commands\traits\Options;
use hyperia\yii2\aws\s3\interfaces\commands\Command;
use hyperia\yii2\aws\s3\interfaces\commands\HasBucket;
class MyCommand implements Command, HasBucket
{
Expand Down Expand Up @@ -204,7 +197,7 @@ The handler for this command looks like this:
namespace app\components\s3\handlers;
use app\components\s3\commands\MyCommand;
use frostealth\yii2\aws\s3\base\handlers\Handler;
use hyperia\yii2\aws\s3\base\handlers\Handler;
class MyCommandHandler extends Handler
{
Expand All @@ -222,7 +215,7 @@ class MyCommandHandler extends Handler
And usage this command:
```php
/** @var \frostealth\yii2\aws\s3\interfaces\Service */
/** @var \hyperia\yii2\aws\s3\interfaces\Service */
$s3 = Yii::$app->get('s3');
/** @var \app\components\s3\commands\MyCommand $command */
Expand All @@ -240,8 +233,8 @@ Custom plain command looks like this:
namespace app\components\s3\commands;
use frostealth\yii2\aws\s3\interfaces\commands\HasBucket;
use frostealth\yii2\aws\s3\interfaces\commands\PlainCommand;
use hyperia\yii2\aws\s3\interfaces\commands\HasBucket;
use hyperia\yii2\aws\s3\interfaces\commands\PlainCommand;
class MyPlainCommand implements PlainCommand, HasBucket
{
Expand Down
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "frostealth/yii2-aws-s3",
"name": "hyperia/yii2-aws-s3",
"type": "yii2-extension",
"description": "An Amazon S3 component for Yii2",
"keywords": ["yii2", "aws", "s3", "aws-s3", "yii2-aws", "yii2-s3"],
"homepage": "https://github.com/frostealth/yii2-aws-s3",
"homepage": "https://github.com/hyperia-sk/yii2-aws-s3",
"license": "MIT",
"authors": [
{
Expand All @@ -14,10 +14,15 @@
{
"name": "Constantine Chuprik",
"email": "[email protected]"
},
{
"name": "Rudolf Krupa",
"email": "[email protected]",
"homepage": "https://www.hyperia.sk"
}
],
"support": {
"issues": "https://github.com/frostealth/yii2-aws-s3/issues?state=open"
"issues": "https://github.com/hyperia-sk/yii2-aws-s3/issues?state=open"
},
"require": {
"php": ">=7.0.0",
Expand All @@ -30,7 +35,7 @@
},
"autoload": {
"psr-4": {
"frostealth\\yii2\\aws\\s3\\": "src/"
"hyperia\\yii2\\aws\\s3\\": "src/"
}
}
}
12 changes: 6 additions & 6 deletions src/Bus.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace frostealth\yii2\aws\s3;
namespace hyperia\yii2\aws\s3;

use frostealth\yii2\aws\s3\interfaces;
use hyperia\yii2\aws\s3\interfaces;

/**
* Class Bus
*
* @package frostealth\yii2\aws\s3
* @package hyperia\yii2\aws\s3
*/
class Bus implements interfaces\Bus
{
Expand All @@ -17,22 +17,22 @@ class Bus implements interfaces\Bus
/**
* Bus constructor.
*
* @param \frostealth\yii2\aws\s3\interfaces\HandlerResolver $inflector
* @param \hyperia\yii2\aws\s3\interfaces\HandlerResolver $inflector
*/
public function __construct(interfaces\HandlerResolver $inflector)
{
$this->resolver = $inflector;
}

/**
* @param \frostealth\yii2\aws\s3\interfaces\commands\Command $command
* @param \hyperia\yii2\aws\s3\interfaces\commands\Command $command
*
* @return mixed
*/
public function execute(interfaces\commands\Command $command)
{
$handler = $this->resolver->resolve($command);

return call_user_func([$handler, 'handle'], $command);
}
}
12 changes: 6 additions & 6 deletions src/CommandBuilder.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace frostealth\yii2\aws\s3;
namespace hyperia\yii2\aws\s3;

use frostealth\yii2\aws\s3\interfaces;
use hyperia\yii2\aws\s3\interfaces;

/**
* Class CommandBuilder
*
* @package frostealth\yii2\aws\s3
* @package hyperia\yii2\aws\s3
*/
class CommandBuilder implements interfaces\CommandBuilder
{
Expand All @@ -23,7 +23,7 @@ class CommandBuilder implements interfaces\CommandBuilder
/**
* CommandBuilder constructor.
*
* @param \frostealth\yii2\aws\s3\interfaces\Bus $bus
* @param \hyperia\yii2\aws\s3\interfaces\Bus $bus
* @param string $bucket
* @param string $acl
*/
Expand All @@ -37,7 +37,7 @@ public function __construct(interfaces\Bus $bus, string $bucket = '', string $ac
/**
* @param string $className
*
* @return \frostealth\yii2\aws\s3\interfaces\commands\Command
* @return \hyperia\yii2\aws\s3\interfaces\commands\Command
* @throws \yii\base\InvalidConfigException
*/
public function build(string $className): interfaces\commands\Command
Expand All @@ -53,7 +53,7 @@ public function build(string $className): interfaces\commands\Command
}

/**
* @param \frostealth\yii2\aws\s3\interfaces\commands\Command $command
* @param \hyperia\yii2\aws\s3\interfaces\commands\Command $command
*/
protected function prepareCommand(interfaces\commands\Command $command)
{
Expand Down
48 changes: 24 additions & 24 deletions src/CommandFactory.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?php

namespace frostealth\yii2\aws\s3;

use frostealth\yii2\aws\s3\commands\DeleteCommand;
use frostealth\yii2\aws\s3\commands\ExistCommand;
use frostealth\yii2\aws\s3\commands\GetCommand;
use frostealth\yii2\aws\s3\commands\GetPresignedUrlCommand;
use frostealth\yii2\aws\s3\commands\GetUrlCommand;
use frostealth\yii2\aws\s3\commands\PutCommand;
use frostealth\yii2\aws\s3\commands\RestoreCommand;
use frostealth\yii2\aws\s3\commands\UploadCommand;
use frostealth\yii2\aws\s3\commands\ListCommand;
use frostealth\yii2\aws\s3\interfaces;
namespace hyperia\yii2\aws\s3;

use hyperia\yii2\aws\s3\commands\DeleteCommand;
use hyperia\yii2\aws\s3\commands\ExistCommand;
use hyperia\yii2\aws\s3\commands\GetCommand;
use hyperia\yii2\aws\s3\commands\GetPresignedUrlCommand;
use hyperia\yii2\aws\s3\commands\GetUrlCommand;
use hyperia\yii2\aws\s3\commands\PutCommand;
use hyperia\yii2\aws\s3\commands\RestoreCommand;
use hyperia\yii2\aws\s3\commands\UploadCommand;
use hyperia\yii2\aws\s3\commands\ListCommand;
use hyperia\yii2\aws\s3\interfaces;

/**
* Class CommandFactory
*
* @package frostealth\yii2\aws\s3
* @package hyperia\yii2\aws\s3
*/
class CommandFactory
{
/** @var \frostealth\yii2\aws\s3\interfaces\CommandBuilder */
/** @var \hyperia\yii2\aws\s3\interfaces\CommandBuilder */
protected $builder;

/**
* CommandFactory constructor.
*
* @param \frostealth\yii2\aws\s3\interfaces\CommandBuilder $builder
* @param \hyperia\yii2\aws\s3\interfaces\CommandBuilder $builder
*/
public function __construct(interfaces\CommandBuilder $builder)
{
Expand All @@ -36,7 +36,7 @@ public function __construct(interfaces\CommandBuilder $builder)
/**
* @param string $filename
*
* @return \frostealth\yii2\aws\s3\commands\GetCommand
* @return \hyperia\yii2\aws\s3\commands\GetCommand
*/
public function get(string $filename): GetCommand
{
Expand All @@ -51,7 +51,7 @@ public function get(string $filename): GetCommand
* @param string $filename
* @param mixed $body
*
* @return \frostealth\yii2\aws\s3\commands\PutCommand
* @return \hyperia\yii2\aws\s3\commands\PutCommand
*/
public function put(string $filename, $body): PutCommand
{
Expand All @@ -65,7 +65,7 @@ public function put(string $filename, $body): PutCommand
/**
* @param string $filename
*
* @return \frostealth\yii2\aws\s3\commands\DeleteCommand
* @return \hyperia\yii2\aws\s3\commands\DeleteCommand
*/
public function delete(string $filename): DeleteCommand
{
Expand All @@ -80,7 +80,7 @@ public function delete(string $filename): DeleteCommand
* @param string $filename
* @param mixed $source
*
* @return \frostealth\yii2\aws\s3\commands\UploadCommand
* @return \hyperia\yii2\aws\s3\commands\UploadCommand
*/
public function upload(string $filename, $source): UploadCommand
{
Expand All @@ -95,7 +95,7 @@ public function upload(string $filename, $source): UploadCommand
* @param string $filename
* @param int $days lifetime of the active copy in days
*
* @return \frostealth\yii2\aws\s3\commands\RestoreCommand
* @return \hyperia\yii2\aws\s3\commands\RestoreCommand
*/
public function restore(string $filename, int $days): RestoreCommand
{
Expand All @@ -109,7 +109,7 @@ public function restore(string $filename, int $days): RestoreCommand
/**
* @param string $filename
*
* @return \frostealth\yii2\aws\s3\commands\ExistCommand
* @return \hyperia\yii2\aws\s3\commands\ExistCommand
*/
public function exist(string $filename): ExistCommand
{
Expand All @@ -123,7 +123,7 @@ public function exist(string $filename): ExistCommand
/**
* @param string $prefix
*
* @return \frostealth\yii2\aws\s3\commands\ListCommand
* @return \hyperia\yii2\aws\s3\commands\ListCommand
*/
public function list(string $prefix): ListCommand
{
Expand All @@ -137,7 +137,7 @@ public function list(string $prefix): ListCommand
/**
* @param string $filename
*
* @return \frostealth\yii2\aws\s3\commands\GetUrlCommand
* @return \hyperia\yii2\aws\s3\commands\GetUrlCommand
*/
public function getUrl(string $filename): GetUrlCommand
{
Expand All @@ -152,7 +152,7 @@ public function getUrl(string $filename): GetUrlCommand
* @param string $filename
* @param mixed $expires
*
* @return \frostealth\yii2\aws\s3\commands\GetPresignedUrlCommand
* @return \hyperia\yii2\aws\s3\commands\GetPresignedUrlCommand
*/
public function getPresignedUrl(string $filename, $expires): GetPresignedUrlCommand
{
Expand Down
Loading

0 comments on commit 099a561

Please sign in to comment.