From 6bf380fa17880b49d41168cd4a06f0547f5ed753 Mon Sep 17 00:00:00 2001 From: cbeauvoi Date: Wed, 20 Feb 2019 11:24:22 +0100 Subject: [PATCH] from wtf to package --- {Adaptors => StorageBundle/Adaptors}/S3Storage.php | 0 .../DependencyInjection/Configuration.php | 22 ++ .../DependencyInjection/StorageExtension.php | 33 ++ StorageBundle/Ressources/config/services.yaml | 6 + Storage.php => StorageBundle/Storage.php | 23 ++ StorageBundle/StorageBundle.php | 22 ++ composer.json | 22 ++ composer.lock | 430 +++++++++++++++++++++ storage_example.yaml | 23 -- 9 files changed, 558 insertions(+), 23 deletions(-) rename {Adaptors => StorageBundle/Adaptors}/S3Storage.php (100%) create mode 100644 StorageBundle/DependencyInjection/Configuration.php create mode 100644 StorageBundle/DependencyInjection/StorageExtension.php create mode 100644 StorageBundle/Ressources/config/services.yaml rename Storage.php => StorageBundle/Storage.php (58%) create mode 100644 StorageBundle/StorageBundle.php create mode 100644 composer.json create mode 100644 composer.lock delete mode 100644 storage_example.yaml diff --git a/Adaptors/S3Storage.php b/StorageBundle/Adaptors/S3Storage.php similarity index 100% rename from Adaptors/S3Storage.php rename to StorageBundle/Adaptors/S3Storage.php diff --git a/StorageBundle/DependencyInjection/Configuration.php b/StorageBundle/DependencyInjection/Configuration.php new file mode 100644 index 0000000..58d063c --- /dev/null +++ b/StorageBundle/DependencyInjection/Configuration.php @@ -0,0 +1,22 @@ +root('storage'); + return ($treeBuilder); + } +} diff --git a/StorageBundle/DependencyInjection/StorageExtension.php b/StorageBundle/DependencyInjection/StorageExtension.php new file mode 100644 index 0000000..05935bc --- /dev/null +++ b/StorageBundle/DependencyInjection/StorageExtension.php @@ -0,0 +1,33 @@ +load('services.yaml'); + $configuration = $this->getConfiguration($configs, $container); + dump($configuration); die; + $config = $this->processConfiguration($configuration, $configs); + + return $config; + } + + public function getAlias() + { + return parent::getAlias(); // TODO: Change the autogenerated stub + } +} diff --git a/StorageBundle/Ressources/config/services.yaml b/StorageBundle/Ressources/config/services.yaml new file mode 100644 index 0000000..51defb8 --- /dev/null +++ b/StorageBundle/Ressources/config/services.yaml @@ -0,0 +1,6 @@ +services: + bluesquare.storage: + class: Bluesquare\StorageBundle\Storage + autowire: true + public: true + Bluesquare\CryptorBundle\Cryptor: '@bluesquare.storage' diff --git a/Storage.php b/StorageBundle/Storage.php similarity index 58% rename from Storage.php rename to StorageBundle/Storage.php index 423d109..cfdafb7 100644 --- a/Storage.php +++ b/StorageBundle/Storage.php @@ -22,3 +22,26 @@ class Storage return null; // (on ajoutera d'autres types de stockage plus tard, dont le stockage de fichier sur le serveur actuel) } } + +//storage: +//photos: +//type: s3 +// bucket: bluesquare.public +// region: nl-ams +// endpoint: 'https://s3.nl-ams.scw.cloud' +// credentials: +// key: '%env(MYSUPERSECRETAWSKEY)%' +// secret: '%env(MYSUPERSECRETAWSSECRET)%' +// version: lastest # optionnel +// path: '/photos' # optionnel +// +// files: +// type: s3 +// bucket: bluesquare.private +// region: nl-ams +// endpoint: 'https://s3.nl-ams.scw.cloud' +// credentials: +// key: '%env(MYSUPERSECRETAWSKEY)%' +// secret: '%env(MYSUPERSECRETAWSSECRET)%' +// +// ... diff --git a/StorageBundle/StorageBundle.php b/StorageBundle/StorageBundle.php new file mode 100644 index 0000000..e7d9a0d --- /dev/null +++ b/StorageBundle/StorageBundle.php @@ -0,0 +1,22 @@ +extension) + $this->extension = new StorageExtension(); + return $this->extension; + } +} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..333eefc --- /dev/null +++ b/composer.json @@ -0,0 +1,22 @@ +{ + "name": "bluesquare-packages/symfony-storage", + "description": "Cryptor created by Bluesquare Computing", + "keywords": ["template", "composer", "package"], + "license": "proprietary", + "authors": [ + { + "name": "RENOU Maxime", + "email": "maxime@bluesquare.io" + } + ], + "type": "symfony-bundle", + "require": { + "php": ">=7.1", + "aws/aws-sdk-php": "^3.81" + }, + "autoload": { + "psr-4": { + "Bluesquare\\StorageBundle\\": "StorageBundle/" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..eeef08c --- /dev/null +++ b/composer.lock @@ -0,0 +1,430 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "ee1506d010b16feb41b779df9e156bc2", + "packages": [ + { + "name": "aws/aws-sdk-php", + "version": "3.87.14", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "1d442bd93d3648e403ab895b5e1f464b4aa1b376" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/1d442bd93d3648e403ab895b5e1f464b4aa1b376", + "reference": "1d442bd93d3648e403ab895b5e1f464b4aa1b376", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^5.3.3|^6.2.1", + "guzzlehttp/promises": "~1.0", + "guzzlehttp/psr7": "^1.4.1", + "mtdowling/jmespath.php": "~2.2", + "php": ">=5.5" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "nette/neon": "^2.3", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "psr/cache": "^1.0" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Aws\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "time": "2019-02-19T19:08:06+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.3-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-04-22T15:46:56+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "9f83dded91781a01c63574e387eaa769be769115" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2018-12-04T20:46:45+00:00" + }, + { + "name": "mtdowling/jmespath.php", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "adcc9531682cf87dfda21e1fd5d0e7a41d292fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/adcc9531682cf87dfda21e1fd5d0e7a41d292fac", + "reference": "adcc9531682cf87dfda21e1fd5d0e7a41d292fac", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "JmesPath\\": "src/" + }, + "files": [ + "src/JmesPath.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "time": "2016-12-03T22:08:25+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2016-02-11T07:05:27+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1" + }, + "platform-dev": [] +} diff --git a/storage_example.yaml b/storage_example.yaml deleted file mode 100644 index e955e1a..0000000 --- a/storage_example.yaml +++ /dev/null @@ -1,23 +0,0 @@ -storage: - - photos: - type: s3 - bucket: bluesquare.public - region: nl-ams - endpoint: 'https://s3.nl-ams.scw.cloud' - credentials: - key: '%env(MYSUPERSECRETAWSKEY)%' - secret: '%env(MYSUPERSECRETAWSSECRET)%' - version: lastest # optionnel - path: '/photos' # optionnel - - files: - type: s3 - bucket: bluesquare.private - region: nl-ams - endpoint: 'https://s3.nl-ams.scw.cloud' - credentials: - key: '%env(MYSUPERSECRETAWSKEY)%' - secret: '%env(MYSUPERSECRETAWSSECRET)%' - - ... \ No newline at end of file