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/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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui