Weave Code
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-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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle