Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

File Bundle Laravel Package

bengor-file/file-bundle

View on GitHub
Deep Wiki
Context7

Gaufrette

Instead of use the Symfony filesystem as storage layer you can use the Gaufrette solution that is a more robust option and provides different adapters, for example, it can store in an easy way the data in S3.

Firstly, install the bundle with Composer

$ composer require bengor-file/gaufrette-filesystem-bridge-bundle

Once the bundle has been installed enable it in the AppKernel:

// app/config/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
        new BenGorFile\GaufretteFilesystemBridgeBundle\BenGorFileGaufretteFilesystemBridgeBundle(),  
        // ...
    ];
}

Configuration

In order to use Gaufrette you have to configure it. Here is a sample configuration that stores your file in your local filesystem, but keep in mind, you can use your preferred adapters. Check the Gaufrette documentation for more information.

# app/config/config.yml

knp_gaufrette:
    stream_wrapper: ~ 
    adapters:
        image_adapter:
            local:
                directory: '%kernel.root_dir%/../web/uploads/images'
                create: true
    filesystems:
        image_filesystem:
            adapter: image_adapter

ben_gor_file:
    file_class:
        image:
            class: AppBundle\Entity\Image
            storage: gaufrette
            upload_destination: image_filesystem

Note:

Make sure that Gaufrette stream wrapper is enabled and its protocol must have the gaufrette name, otherwise it does not work.

Note:

In this case upload_destination refers to a Gaufrette filesystem.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dakiquang/laravel-oauth-refresh-lock
woda/laravel-worktrees
dalefranks/ramasite
faghy/laracashbook
roundly-consulting/google-places-for-laravel
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
adachsoft/changelog-linter