Giter Site home page Giter Site logo

knpgaufrettebundle's Introduction

Gaufrette Bundle

Build Status

Provides a Gaufrette integration for your Symfony projects.

SWUbanner

About Gaufrette

Gaufrette is a PHP library providing a filesystem abstraction layer. This abstraction layer allows you to develop applications without needing to know where all their media files will be stored or how.

Documentation is available the official page of Gaufrette.

Installation

Prerequisites

As this bundle is an integration for Symfony of the Gaufrette library, it requires you to first install Gaufrette in your project.

Note that, you need to install separately the adapters you want to use. You can find more details about these packages here, and the full list adapters on packagist.

With composer

composer require knplabs/knp-gaufrette-bundle

Register the bundle

You must register the bundle in your kernel:

<?php

return [
    // ...
    Knp\Bundle\GaufretteBundle\KnpGaufretteBundle::class => ['all' => true],
];

Configuration

The Gaufrette bundle allows you to declare your filesystems as services without having to reach into the famous "Service Container". Indeed, you can do it with the configuration!

The configuration of the Gaufrette bundle is divided into two parts: the adapters and the filesystems.

Configuring the Adapters

# config/packages/knp_gaufrette.yaml
knp_gaufrette:
    adapters:
        foo:
            local:
                directory: /path/to/my/filesystem

The defined adapters are then used to create the filesystems.

You can use on of these adapters:

Configuring the Filesystems

# config/packages/knp_gaufrette.yaml
knp_gaufrette:
    adapters:
        # ...
    filesystems:
        bar:
            adapter:    foo
            alias:      foo_filesystem

Each defined filesystem must have an adapter with its value set to an adapter's key. The filesystem defined above will result in a service with id gaufrette.bar_filesystem. The alias parameter allows us to define an alias for it (foo_filesystem in this case).

The filesystem map

You can access all declared filesystems through the map service. In the previous exemple, we declared a bar filesystem:

$container->get('knp_gaufrette.filesystem_map')->get('bar');

Returns the bar instance of Gaufrette\Filesystem.

Use cases

Check out basic examples of the library.

Maintainers

KNPLabs is looking for maintainers (see why).

If you are interested, feel free to open a PR to ask to be added as a maintainer.

We’ll be glad to hear from you :)

knpgaufrettebundle's People

Contributors

aaronadal avatar acrobat avatar akovalyov avatar alexpozzi avatar awkan avatar bocharsky-bw avatar caponica avatar docteurklein avatar garak avatar gesthispania avatar havvg avatar herzult avatar kbond avatar koriseng avatar l3l0 avatar mbontemps avatar mtarvainen avatar mvhirsch avatar nek- avatar nicolasmure avatar nm2107 avatar nyholm avatar ornicar avatar oskarstark avatar quingkhaos avatar radutopala avatar robinvdvleuten avatar roukmoute avatar schmittjoh avatar vyacheslavk 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

knpgaufrettebundle's Issues

Use the native filesystem map

Hello!

I need to create some filesystem on-the-fly that is why needed the ability to append the filesystem to existing filesystem map. I do not understand why is used "Knp\Bundle\GaufretteBundle\FilesystemMap" and not "Gaufrette\FilesystemMap". The last enables work with filesystem map more flexibly.

Does it make a sense to refuse from "Knp\Bundle\GaufretteBundle\FilesystemMap" and use "Gaufrette\FilesystemMap"? I can make PR.

Thanks!

Issue when trying to read a file.

I am not sure if the problem is with this bundle but when I try to upload a file with "VichUploaderBundle" this is the error.

Warning: finfo::file(): File or path not found 'gaufrette://page_file_fs/f31e3f97190eba2a1c0fdc5b94cda4cb.jpeg' in /var/www/sitename/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php line 55 

And this is my conf

knp_gaufrette:
    stream_wrapper: ~
    adapters:
        page_adapter:
            local:
                directory: %kernel.root_dir%/../web/media/page
                create:     true
    filesystems:
        page_file_fs:
            adapter:    page_adapter

In my dev box it works flawlessly but I can't make it work in the production server. I am maybe forgetting something? The upload actually works (the file is in the designated directory) but the code someplace tries to read the recently uploaded file with finfo and it fails.

Help?

PhpseclibSftp Adapter + solution for the fact that it eagerly loads/connects

This issue arises from using the recently added PhpseclibSftp adapter.

Rather than simply creating a new Adapter Factory - or using the existing sftp adapter factory - I've found a need to create a new adapter which lazy loads the underlying PhpseclibSftp adapter.

Reasons I've had to do this:

  • Using the existing SftpAdapterFactory relies on the passed adapter being an instance of Ssh/Sftp (which this clearly isn't).
  • Even if the above were solved - constructing the Net_SFTP object that this adapter uses tries to perform a connection even if the adapter isn't being used in the request (It connects by virtue of being in the application configuration).

While the second issue here is more with the underlying adapter (than the simple configuration that this bundle provides) - I felt it better to commit everything into the same place rather than split the commit across two bundles. If the lazy loading implementation here is acceptable then it might better belong in the Gaufrette bundle itself.

I know the creation of the Adapter folder in the DependencyInjection folder isn't ideal - so perhaps it should be moved as described above

The commit in question is here:

https://github.com/calumbrodie/KnpGaufretteBundle/commit/0074d7031b5621cca938cf16f73b5d2bacd5af79

Amazon S3 - Metadata/MimeType

Hello,

I was trying to write a file to an AmazonS3 filesystem and everything works, except that it writes the file as a generic mimetype.

How can we specify the mimetype of the file before writing it (ex: image/jpg). The bundle or services don't seem to allow us to do that.

Amazon S3 config base_url needed

Hi, I need to be able to provide the base_url in the config so that I can give a scheme agnostic absolute path such as

//my-bucket.s3.amazonaws.com

so that it will work on both http and https

At the moment I can only pull images from s3 over http.

There is no 'bar' filesystem defined

My configuration is like that:

knp_gaufrette:
    adapters:
        local_adapter:         
            local:
                directory: %kernel.root_dir%/../web/uploads        

    filesystems:
        bar:
            adapter:    local_adapter
            alias:      local_filesystem                    

When I am going to run $ php app/console gaufrette:filesystem:keys bar
from command line there is occuring an exception saying

[RuntimeException]
There is no 'bar' filesystem defined.

Where did I make wrong? What is the correct way of installing this bundle?

Ssh\Sftp not found

Hi,

I'm using the KnpGaufretteBundle with oneup uploader (https://github.com/1up-lab/OneupUploaderBundle) to store uploaded files in a distant folder.

Problem

When I try to upload files from my browser, the server throws an error 500:

title="Symfony\Component\Debug\Exception\FatalErrorException">FatalErrorException</abbr>: Error: Class 'Ssh\Sftp' not found in /Users/Alex/NXWebsite/app/cache/dev/appDevDebugProjectContainer.php line 1957</h2>

Configuration

  • Symfony 2.3
  • Composer.json (I installed the bundle using php composr.phar update):
"require": {
    "oneup/uploader-bundle": "1.0.*@dev",
    "knplabs/knp-gaufrette-bundle": "0.1.*"
}
  • Parameters.yml:
ssh_host:          127.0.0.1
ssh_username:      myUsername
ssh_password:      myPassword
ssh_path:          /my/path
  • Configuration.yml:
# One Up (video upload)
oneup_uploader:
    mappings:
        videos:
            frontend: blueimp
            storage:
                type: gaufrette
                filesystem: gaufrette.videos_filesystem

# KNP gaufrette (storage layer)
knp_gaufrette:
    adapters:
        videos:
            sftp:
                sftp_id: nx_administration.sftp
                directory: %ssh_path%
                create: true
    filesystems:
        videos:
            adapter: videos
  • nx_administration Bundle - Services.xml:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="nx_administration.ssh.configuration" class="Ssh\Configuration">
            <argument>%ssh_host%</argument>
        </service>
        <service id="nx_administration.ssh.authentication" class="Ssh\Authentication\Password">
            <argument>%ssh_username%</argument>
            <argument>%ssh_password%</argument>
        </service>
        <service id="nx_administration.ssh.session" class="Ssh\Session">
            <argument type="service" id="nx_administration.ssh.configuration"/>
            <argument type="service" id="nx_administration.ssh.authentication"/>
        </service>
        <service id="nx_administration.sftp" class="Ssh\Sftp">
            <argument type="service" id="nx_administration.ssh.session"/>
        </service>
    </services>
</container>

Retrive image url Amazon S3 -> Twig Template

Hello,

I have successfully set up VichUploaderBundle to work with GaufretteBundle and linked it to my Amazon S3 Bucket. Now, since the upload works fine I find my file in the S3 bucket with no problem but I cannot figure out how to retrive it from there.

I have the gaufrette wrapper to my file, which looks like gaufrette://amazon_s3_storage/test.jpg and I would like to see the picture in my Twig template. Is there any function I can use directly in my twig template?

From the controller point of view, the image seems to exist since file_exists($image->getImage()) returns 1 as result and $image->getImage() is the gaufrette wrapper mentioned above.

Thank you for your support!
Andy.

Create proper filesystem management commands

I would (really) love to have some management commands to read, write, list (etc) keys stored on a filesystem.

I propose the following commands:

Name Arguments Description
gaufrette:read filesystem key shows the content of key on filesystem
gaufrette:write filesystem key content writes content on filesystem usign the name key
gaufrette:exists filesystem key checks if key exists on filesystem
gaufrette:keys filesystem [blob] lists all keys in filesystem (optionally filtered by blob)
gaufrette:delete filesystem key deletes key in filesystem
gaufrette:rename filesystem key1 key1 renames key1 to key2 in filesystem

What do you think about it?
It should be quite easy to implement them as separate symfony commands and using the filesystem mapper service as way to retrieve configured filesystems.

Logging Errors

Hi,

im not sure whether this is an actual issue of the bundle, but I am using Gaufrette with LiipImagineBundle and experience very random behaviour. On some deploy's it is working on some others just not. Without any changes to the actual codebase. After digging into it i found out that I have some issues on S3 with this error message:

04fadbab7a82c23143855d5c918e1ba8fa32ef1d622c00a3daa9fcdc6daf5d90 gambify-prod [05/Aug/2013:19:03:57 +0000] 173.193.185.250 - 133EF43443891C63 REST.HEAD.OBJECT profile_thumb_small/51e9a03453c80.jpeg "HEAD /profile_thumb_small/51e9a03453c80.jpeg HTTP/1.1" 403 SignatureDoesNotMatch 1015 - 7 - "https://gambify-prod.s3.amazonaws.com/profile_thumb_small/51e9a03453c80.jpeg" "aws-sdk-php/1.5.17.1 PHP/5.3.23 Linux/2.6.32-042stab068.8 Arch/x86_64 SAPI/fpm-fcgi Integer/9223372036854775807 Build/20121126140000 simplexml/0.1 json/1.2.1 pcre/8.31 spl/0.2 curl/7.19.7 openssl/0.9.8k apc/3.1.9 pdo/1.0.4dev pdo_sqlite/1.0.1 sqlite/2.0-dev sqlite3/0.7-dev zlib/1.1 memory_limit/200M date.timezone/Europe.Berlin open_basedir/off safe_mode/off zend.enable_gc/on" -

I wonder, why I Gaufrette or any other component would not throw an exception or log this issue to monolog, that I would recognise it in my application and not need to go to S3 to find out about it.

Dependency on knplabs/gaufrette v0.1.6

Can you create a new version/tag that has dependency to knplabs/gaufrette v0.1.6. This version uses new AWS SDK version.

I cannot use master as it uses completely old 0.2.*:

    "require":      {
        "symfony/framework-bundle": "2.*",
        "knplabs/gaufrette":        "0.2.*@dev"
    },

Extends knpGaufrette configuration

Hi,

There is a little problem in Knp\Bundle\GaufretteBundle\DependencyInjection\KnpGaufretteExtension, line 54, with this code : $container->getDefinition('knp_gaufrette.filesystem_map')->replaceArgument(0, $map);
If i want to make a bundle who add adapters and filesystems, i can't, cause this code will replace everything i've added (in case of my bundle is registered after GaufretteBundle in AppKernel, if GaufretteBundle is registered after my bundle, my adapters and filesystems are deleted by this code).

Could you make methods on your knp_gaufrette.filesystem_map service, like addAdapter and addFileSystem, and call it from your config loader ? In this case, my bundle can add adpeters and filesystem without any problems :)

While you are on KnpGaufretteExtension, could you set all your methods to protected ? I need it cause if i extends your KnpGaufretteExtension, i can't use your methods :(

Thanks,
Steevan

Error: Not an instance of S3SignatureInterface

I'm trying to use Gaufrette with Aws SDK2, and I'm getting the following error on a cache:clear after configuring:

  [Aws\Common\Exception\InvalidArgumentException]                          
  The provided signature value is not an instance of S3SignatureInterface                                                                        

Here is my setup.

composer.json

       "aws/aws-sdk-php": "2.6.*@dev"   

config.yml

services:
  src.aws_s3.client:
    class: Aws\S3\S3Client
    factory_class: Aws\S3\S3Client
    factory_method: 'factory'
    arguments:
      key: %amazon_aws_key%
      secret: %amazon_aws_secret_key%
      region: US Standard

...

knp_gaufrette:
    adapters:
        media_adapter:
            aws_s3:
              service_id: 'src.aws_s3.client'
              bucket_name: my.bucket
              options:
                directory: 'media'

stream writer can't write folders to S3

I have the following config:

knp_gaufrette:
    adapters:
        amazon:
            amazon_s3: 
                amazon_s3_id: site_store.s3
                bucket_name: %site_store.bucket_name%
                create: true

filesystems:
    amazon:
        adapter: amazon

stream_wrapper:
    protocol: s3
    filesystems:
        - amazon

assetic:
    read_from:      %cdn_path_prod%
    write_to:       %cdn_path_prod%

however when I try to dump all of the assets it always gives me:

[RuntimeException]                          
  Unable to create directory s3://amazon/css  

I've looked at the following thread (https://github.com/Cybernox/AmazonWebServicesBundle) and it says to return true in the mkdir function, I did that however it's still erroring. Any idea?

FTP-ASCII Constant not defined in CLI

After installation of the GaufretteBundle my vendor script failed with following error msg:

[ErrorException]
Notice: Use of undefined constant FTP_ASCII - assumed 'FTP_ASCII' in .../vendor/bundles/Knp/Bundle/GaufretteBundle/DependencyInjection/Factory/FtpAdapterFactory.php line 57

To solve this issue I've add the following line at top of FtpAdapterFactory:

if (!defined('FTP_ASCII')) { define('FTP_ASCII', 1); }

This solves the issue for my case.

Composer Error

Hey, when trying to install it via Composer i get following issue:

Your requirements could not be resolved to an installable set of packages.

Problem 1
    - Installation request for knplabs/knp-gaufrette-bundle dev-master -> satisfiable by knplabs/knp-gaufrette-bundle[dev-master].
    - knplabs/knp-gaufrette-bundle dev-master requires knplabs/gaufrette 0.2.*@dev -> no matching package found.
  Problem 2
    - knplabs/knp-gaufrette-bundle dev-master requires knplabs/gaufrette 0.2.*@dev -> no matching package found.
    - symfony/framework-standard-edition 2.4.x-dev requires knplabs/knp-gaufrette-bundle dev-master -> satisfiable by knplabs/knp-gaufrette-bundle[dev-master].
    - Installation request for symfony/framework-standard-edition 2.4.x-dev -> satisfiable by symfony/framework-standard-edition[2.4.x-dev].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

composer show -i

braincrafted/bootstrap-bundle            v2.0.1             BraincraftedBootstrapBundle integrates Bootstrap into Symfony2 by providing templates, Twig extensions, services and commands.
doctrine/annotations                     v1.2.0             Docblock Annotations Parser
doctrine/cache                           v1.3.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                     v1.2               Collections Abstraction library
doctrine/common                          v2.4.2             Common Library for Doctrine projects
doctrine/dbal                            v2.4.2             Database Abstraction Layer
doctrine/doctrine-bundle                 v1.2.0             Symfony DoctrineBundle
doctrine/inflector                       v1.0               Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer                           v1.0               Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                             v2.4.3             Object-Relational-Mapper for PHP
friendsofsymfony/elastica-bundle         v2.1.3-PL1         Elasticsearch PHP integration for your Symfony2 project using Elastica
friendsofsymfony/user-bundle             dev-master ba3e099 Symfony FOSUserBundle
gedmo/doctrine-extensions                dev-master de89aae Doctrine2 behavioral extensions
incenteev/composer-parameter-handler     v2.1.0             Composer script handling your ignored parameter file
jdorn/sql-formatter                      v1.2.17            a PHP SQL highlighting library
jms/metadata                             1.5.0              Class/method/property metadata management in PHP
knplabs/knp-menu                         dev-master 532a4ad An object oriented menu library
knplabs/knp-menu-bundle                  dev-master e6a0756 This bundle provides an integration of the KnpMenu library
kriswallsmith/assetic                    v1.1.2             Asset Management for PHP
monolog/monolog                          1.10.0             Sends your logs to files, sockets, inboxes, databases and various web services
psr/log                                  1.0.0              Common interface for logging libraries
ruflin/elastica                          v0.19.8.0          Elasticsearch Client
sensio/distribution-bundle               v2.3.4             The base bundle for the Symfony Distributions
sensio/framework-extra-bundle            v3.0.1             This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle                  v2.3.5             This bundle generates code for you
sonata-project/admin-bundle              dev-master bce1cd2 Symfony SonataAdminBundle
sonata-project/block-bundle              2.2.12             Symfony SonataBlockBundle
sonata-project/cache                     1.0.3              Cache library
sonata-project/core-bundle               dev-master 08a37ea Symfony SonataCoreBundle
sonata-project/doctrine-orm-admin-bundle dev-master 2705f19 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  1.3.3              Lightweight Exporter library
stof/doctrine-extensions-bundle          dev-master 3825a4a Integration of the gedmo/doctrine-extensions with Symfony2
swiftmailer/swiftmailer                  v5.2.1             Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle                   v2.3.0             Integrates Assetic into Symfony2
symfony/icu                              v1.2.1             Contains an excerpt of the ICU data and classes to load it.
symfony/monolog-bundle                   v2.6.0             Symfony MonologBundle
symfony/swiftmailer-bundle               v2.3.7             Symfony SwiftmailerBundle
symfony/symfony                          v2.5.0             The Symfony PHP framework
twig/extensions                          v1.1.0             Common additional features for Twig that do not directly belong in core
twig/twig                                v1.16.0            Twig, the flexible, fast, and secure template language for PHP
vich/uploader-bundle                     dev-master ba88a3d Ease file uploads attached to entities

Unable to find the wrapper "gaufrette"

Hello.

I have a problem. I get the following error when I want edit my email with FOSUSerBundle.

Warning: is_file(): Unable to find the wrapper "gaufrette" - did you forget to enable it when you configured PHP? in /var/www/workspace/chateagratis/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FileValidator.php line 85 

My config.yml is:

knp_gaufrette:
    adapters:
        product_adapter:
            local:
                directory: %kernel.root_dir%/../web/uploads/fotos
        perfil_adapter:
            local:
                directory: %kernel.root_dir%/../web/uploads/perfil

    filesystems:
        product_image_fs:
            adapter:    product_adapter
        imagen_perfil_fs:
            adapter:    perfil_adapter

vich_uploader:
    db_driver: orm
    gaufrette: true
    storage: vich_uploader.storage.gaufrette
    mappings:
        product_image:
            uri_prefix: /workspace/myproject/web/uploads/perfil
            upload_destination: product_image_fs
        imagen_perfil:
            uri_prefix: /workspace/myproject/web/uploads/perfil
            upload_destination: imagen_perfil_fs  

Any idea? Thanks!!

stability of branch

Hi, many greate bundles use gaufrette master branch, such as
sonata-project/SonataMediaBundle

But after commit f330085 every of them break down with KnpLabs/KnpGaufretteBundle in other dependency

Possibly branch 0.2 already stable enough? and it costs to show out it separately from master?

The service definition "knp_gaufrette.filesystem_map" does not exist. Error

I'm new using Gaufrette and I need some step by step tutorial to make this bundle work. I've added the bundles but tutorial ends there. What services should I add? Where?

Right now I'm getting the error:

The service definition "knp_gaufrette.filesystem_map" does not exist.

trying to test it from a controller using:

$container = new ContainerBuilder();
$container->get('knp_gaufrette.filesystem_map')->get('amazon_file');

I want to work with amazon S3.

Thanks.

Gaufrette issue after editing object

Hi,

I'm on Symfony 2.3, i use knp_gaufrette bundle with vich_uploader bundle with admingenerator bundle. When i create a new object and i upload an image all works perfectly, my image is uploaded, my data base is updated with the name of image but when i want to edit (not update) this object i have this issue insteade of the form :

The specified path (gaufrette://drapeau_image_fs\53d8d34ee6d0e.jpg) is invalid.

Someone for help i search everywhere nad i found no solutions...

Here is my config :

PaysAdmin-generator.yml
...
drapeauFile:
label: Flag
formType: afe_single_upload
dbType: string
addFormOptions:
nameable: drapeau
data_class: Symfony\Component\HttpFoundation\File\File
previewImages: true
previewAsCanvas: true
previewFilter: drapeau200w200h
...

app/config.yml

knp_gaufrette:
stream_wrapper: ~
adapters:
drapeau_adapter:
local:
directory: %kernel.root_dir%/../web/images/drapeau

filesystems:       
    drapeau_image_fs:
        adapter:    drapeau_adapter

vich_uploader:
db_driver: orm
gaufrette: true
twig: true
storage: vich_uploader.storage.gaufrette

mappings:  
    drapeau_image:
        uri_prefix: /images/drapeau
        upload_destination: drapeau_image_fs
        namer: vich_uploader.namer_uniqid
        delete_on_remove: true # determines whether to delete file upon removal of entity
        delete_on_update: true #
        inject_on_load: true # determines whether to inject a File instance upon load

Tag request

Hi guys,

I am using the Gaufrette bundle, which is fantastic! I cannot, however, deploy it as I cannot use dev-master in production due to our minimum stability setting. Would it be possible to get a new tagged version, e.g. 0.1.4?

Thanks,

  • Gavin

Cannot load with Composer

hi

I'm trying to load the bundle with Composer with this json "require" config
"knplabs/knp-gaufrette-bundle": "dev-master"
and Composer complains :

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for knplabs/knp-gaufrette-bundle dev-master -> satisfiable by knplabs/knp-gaufrette-bundle dev-master.
- knplabs/knp-gaufrette-bundle dev-master requires knplabs/gaufrette 0.2.*@dev -> no matching package found.

Potential causes:

  • A typo in the package name
  • The package is not available in a stable-enough version according to your minimum-stability setting
    ...

Thanks for your help

Docs for configuration of ACL aware S3?

Hi,

In issue #40 I reported some trouble I was having with this otherwise marvellous bundle... I have upgraded to the most recent commit, and unfortunately I still cannot make much progress. I cannot pass "options" in (I get the same error as above) so I cannot set "region".

My ops team is suggesting that I need to be able to set the Amazon serviceURL but there doesn't seem to be any documentation of how to use the adapter... Are there any examples I can look at please?

Thanks,

  • Gavin

Streams are read-only ?

Hi !

I'm using gaufrette to store images uploaded with VichUploaderBundle. Every thing works fine on this part.

Once images are uploaded and stored on the fs through gaufrette, I want to crop them with the Imagine library. Here is what I do in my code:

                $imagine = new Imagine\Gd\Imagine();

                $image = $imagine->open('gaufrette://product_image_fs/'.$product->getImageName());
                $image->crop(new Point(0, 0), new Box(15, 15))
                      ->save('gaufrette://product_image_fs/min_'.$product->getImageName());

But this results in the following error:

imagejpeg() [<a href='function.imagejpeg'>function.imagejpeg</a>]: Unable to open 'gaufrette://product_image_fs/min_5125ec79dfb61.jpeg' for writing: Invalid argument 
500 Internal Server Error - RuntimeException
1 linked Exception:
ErrorException »

Can't we use stream wrappers in write mode ?

Thanks

Zab

New tag for newer Amazon Client

I'd really like to switch to the new Amazon client so I can use their new SDK but need a stable tag to do so - please could you make a new tag for this library?

Stream Wrapper with aws_s3 adapter, does it work?

I'm trying to use the stream wrapper to save uploaded images to AWS S3, using the following in my php upload code:

//... get and process $uploadedImage from Request
$destinationPath = 'gaufrette://my_assets/images/1.jpeg'
$f = fopen($destinationPath, 'w');
fwrite($f, $uploadedImage); 
fclose($f);

I first tried the following configuration using a "local" adapter as follows and it works (I'm able to save the new image to the local filesystem):

knp_gaufrette:
    adapters:
        my_assets:
            local:
                directory: "%kernel.root_dir%/../web"
    filesystems:
        my_assets:
            adapter:    my_assets
            alias:      my_assets_filesystem
    stream_wrapper: ~

However, when I try to use the aws_s3 adapter as follows, I get an unknown error:

knp_gaufrette:
    adapters:
        my_assets:
            aws_s3:
                service_id: acme.aws_s3.client
                bucket_name: %amazon_s3_bucket%
    filesystems:
        my_assets:
            adapter:    my_assets
            alias:      my_assets_filesystem
    stream_wrapper: ~

services:
    acme.aws_s3.client:
        class: Aws\S3\S3Client
        factory_class: Aws\S3\S3Client
        factory_method: factory
        arguments:
            -
                key: %amazon_s3.key%
                secret: %amazon_s3.secret%
                region: %amazon_s3.region%

Does the Amazon AWS S3 stream work by default with this bundle? or one needs to add or register some other class for the AWS S3 stream wrapper to work?
Could someone give further instructions about this?

S3Adapter ACL

The default ACL for s3 is private, so why does the normal non acl aware adapter chose to set an acl on write of public? It seems to me that is should not set an acl. If an acl needs to be set then the AclAwareAdapter should be used.

bucket names with "." do not work

Hi guys,

When I set a bucket name wich contains a dot (example.com) I get an error "Could not write the xxxx content".

It works with bucket names wich do not contain dots.

Unfortunately to configure a bucket for Cloudfront, it requires a domain-like bucket name.

Here is my config:

knp_gaufrette:
    adapters:
        uploads:
            amazon_s3:
                amazon_s3_id: service.amazon.s3
                bucket_name: example.com
                options:
                    create: true
    filesystems:
        amazon_s3:
            adapter: uploads

OpenCloud Lazy Connection?

Hi all,

Gaufrette has recently added lazy-loading OpenCloud connections (KnpLabs/Gaufrette@5084853). Is this feature currently supported in this bundle? I can't seem to find this in the documentation.. If not, I may be able to contribute this (assuming I can model it off the lazyloading Rackspace connection that already exists here).

Thanks!

Incorrect composer dependencies

I'm getting this error when adding the KpnGaufretteBundle to my composer.json

Problem 1
- Installation request for knplabs/knp-gaufrette-bundle dev-master -> satisfiable by knplabs/knp-gaufrette-bundle
v-master].
- knplabs/knp-gaufrette-bundle dev-master requires knplabs/gaufrette 0.2.*@dev -> no matching package found.

Potential causes:

How Add Expires headers ?

Hello.

I want add Expires headers to my images .

I am using the the adapter to amazon:

Amazon S3 (amazon_s3)
"amazonwebservices/aws-sdk-for-php"

Somebody knows how can I add expire headers ? thanks in advance! : )

Metadata amazon S3

Hi everyone,

Just a simple question here. Is there a way to add metadata as cache control while writing a file on S3 ?

Thanks

Install knplabs/knp-gaufrette-bundle:dev-master using composer require

This:

php composer.phar require knplabs/knp-gaufrette-bundle:dev-master

Returns:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for knplabs/knp-gaufrette-bundle dev-master -> satisfiable by knplabs/knp-gaufrette-bundle[dev-master].
    - knplabs/knp-gaufrette-bundle dev-master requires knplabs/gaufrette 0.2.*@dev -> no matching package found.
  Problem 2
    - knplabs/knp-gaufrette-bundle dev-master requires knplabs/gaufrette 0.2.*@dev -> no matching package found.
    - symfony/framework-standard-edition 2.3.x-dev requires knplabs/knp-gaufrette-bundle dev-master -> satisfiable by knplabs/knp-gaufrette-bundle[dev-master].
    - Installation request for symfony/framework-standard-edition 2.3.x-dev -> satisfiable by symfony/framework-standard-edition[2.3.x-dev].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

But this works fine:

php composer.phar require knplabs/knp-gaufrette-bundle:dev-master knplabs/gaufrette:dev-master

How to configure ACL aware Amazon S3?

Hi,

I am using Symfony2 with "knplabs/knp-gaufrette-bundle" : "0.1.4" and need to configure ACL aware S3

I have tried:

knp_gaufrette:
  adapters:
    amazon_adapter:
        acl_aware_amazon_s3:
            amazon_s3_id: storage.s3
            bucket_name: %storage.s3.bucket_name%
            create: true
            options:
                region: %storage.s3.region%

I got:

InvalidConfigurationException: Unrecognized options "options" under "knp_gaufrette.adapters.amazon_adapter.acl_aware_amazon_s3"

I removed the options and tried:

knp_gaufrette:
  adapters:
    amazon_adapter:
        acl_aware_amazon_s3:
            amazon_s3_id: storage.s3
            bucket_name: %storage.s3.bucket_name%
            create: true

I got:

ErrorException: Warning: array_replace_recursive(): Argument #2 is not an array in /opt/BoxUK/swb/vendor/knplabs/gaufrette/src/Gaufrette/Adapter/AmazonS3.php line 31

This appears to correspond to options not being set.

I can't find any examples of configuring this anywhere online, please could somebody help me out?

Thanks,

  • Gavin

Composer install fails on Symfony 2.3

As with Gaufrette, inside a Symfony 2.3 project composer refuses to install the bundle due to its stability level. Is there anything we can do?
Also, the install procedure illustrated in the README seems to be ok just for Symfony <=2.1.

Read directory config variable

Me need the local directory config.

My config.yml

knp_gaufrette:
    adapters:
        video_adapter:
            local:
                directory: %kernel.root_dir%/../web/video
        image_adapter:
            local:
                directory: %kernel.root_dir%/../web/image

    filesystems:
        video_fs:
            adapter:    video_adapter
        image_fs:
            adapter:    image_adapter
$this->container->get('knp_gaufrette.filesystem_map')->get('video_fs')->getAdapter()
Gaufrette\Adapter\Local Object
(
    [directory:protected] => /home/approach/workspace/www/symfony-standard/web/video
    [create:Gaufrette\Adapter\Local:private] => 1
)

Ok now, i need access to: [directory:protected] => /home/approach/workspace/www/symfony-standard/web/video

Dropbox Adapter

Hello,

Gaufrette seems to have a dropbox adapter, however, this is not present in the bundle configuration options. Can this be added?

Problem With a FTP based on Windows

Hi,

When i want to list all keys of a directory ($fs->keys()), i've got this error :
Undefined offset: 7 in ...\Adapter\Ftp.php line 343

The print_r of $infos of a line is :
Array
(
[0] => 08-24-12
[1] => 05:40PM
[2] => 40758
[3] => data.xml
)

I haven't got more 4 columns.

Stream Audiofile

I am trying to stream an audio file I stored via Gaufrette. I am doing so by using the stream_wrapper.

//Create And Return Response
$filepath = 'gaufrette://media_fs/'.$variant->getFileName();
$response = new \Symfony\Component\HttpFoundation\BinaryFileResponse($filepath);
return $response;

however, when I do this, on the client side I get a flat text file which is something like this:

/Applications/MAMP/tmp/php/phpMRI7pq

It is not streaming the audiofile itself.

please help

Add README and instructions about AmazonS3 usage

Hi, I'm trying to use Amazon S3 as filesystem using KnpGaufretteBundle but I don't understand how to do it and readme doesn't show anything about S3. Could anyone explain me what should I do? :(

Thanks!

S3 StreamWrapper issue with Directories

So I've setup my S3 StreamWrapper

knp_gaufrette:
    adapters:
        amazon:
            amazon_s3:
                amazon_s3_id: aws_s3
                bucket_name: %aws_bucket%
                create: true
                options:
                    region: %aws_region%

    filesystems:
        amazon:
            adapter: amazon

    stream_wrapper:
        protocol: data
        filesystems:
            s3: amazon

I'm trying to move an uploaded file to s3: $this->file->move($this->getUploadRootDir(), $this->id . '.' . $this->extension); where $this->getUploadRootDir() resolves to data://s3/pictures/profiles

However in the move function it looks to see if $directory is an actual directory and tries to create it which seems to trick the stream wrapper a bit. Have I done something wrong? I thought the stream wrapper should be able to overcome these sort of issues?

Thanks

incorrect dependencies causing composer to fail

composer require knplabs/knp-gaufrette-bundle:dev-master knplabs/gaufrette:dev-master

  • Installation request for knplabs/gaufrette dev-master -> satisfiable by knplabs/gaufrette[dev-master].
    • knplabs/knp-gaufrette-bundle dev-master requires knplabs/gaufrette ~0.1.7 -> satisfiable by knplabs/gaufrette[0.1.x-dev].
    • Can only install one of: knplabs/gaufrette[dev-master, 0.1.x-dev].
    • Installation request for knplabs/knp-gaufrette-bundle dev-master -> satisfiable by knplabs/knp-gaufrette-bundle[dev-master].

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.