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

Getting started

By default we recommend the following installation that will add the following adapters to the file bundle.

{
    "require": {
        "bengor-file/file-bundle": "^0.2",

        "bengor-file/doctrine-orm-bridge-bundle": "^1.0",
        "bengor-file/symfony-filesystem-bridge-bundle": "^1.0",
        "bengor-file/simple-bus-bridge-bundle": "^1.0"
    }
} 

Some other adapters for persistence, storage and buses are available.

To install the desired adapters and the bundle itself run the following in the project root:

$ composer update

Make sure you have composer globally installed

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

// app/config/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        
        // Dependencies required by the bundle, keep the order.
        // First bridges and then the FileBundle
                
        // Bridges
        new BenGorFile\SymfonyFilesystemBridgeBundle\BenGorFileSymfonyFilesystemBridgeBundle(),
        new BenGorFile\DoctrineORMBridgeBundle\BenGorFileDoctrineORMBridgeBundle(),
        new BenGorFile\SimpleBusBridgeBundle\BenGorFileSimpleBusBridgeBundle(),
        new BenGorFile\SimpleBusBridgeBundle\BenGorFileSimpleBusDoctrineORMBridgeBundle(),
      
        // File bundle
        new BenGorFile\FileBundle\BenGorFileBundle(),
        // ...
    ];
}

After that, you need to extend our BenGorFile\File\Domain\Model\File class in order to build the Doctrine mapping properly. The following snippet is the minimum code that bundle needs to work.

// src/AppBundle/Entity/File.php

namespace AppBundle\Entity;

use BenGorFile\File\Domain\Model\File as BaseFile;
use Doctrine\ORM\Mapping as ORM;

/**
 * [@ORM](https://github.com/ORM)\Entity
 * [@ORM](https://github.com/ORM)\Table(name="bengor_file")
 */
class File extends BaseFile
{
}

Next, you have to configure the bundle to work with the specific needs of your application in the config.yml:

ben_gor_file:
    file_class:
        file:
            class: AppBundle\Entity\File

This bundle has some basic actions such as upload, overwrite and remove already implemented. Just add the following to your app/config/routing.yml:

ben_gor_file:
    resource: '[@BenGorFileBundle](https://github.com/BenGorFileBundle)/Resources/config/routing/all.yml'

That's all! Now that the bundle is configured, the last thing you need to do is update your database:

$ bin/console doctrine:schema:update --force
  • For multiple files check this guide.
  • In order to use MongoDB's Doctrine ODM as persistence layer follow this chapter.
  • In order to use Gaufrette as filesystem follow this chapter.
  • Back to the index.
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