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

Serving files from Twig

This bundles provides a simple Twig function that simplifies the download file process:

bengor_file_download

Keeping in mind that this bundle supports the multiple file configurations (check "Multiple files" chapter for more information). For example if you have to register in the config.yml

# app/config/config.yml

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

This method needs two arguments that is the file type and the file name and automatically it will generate a public url that exposes in a safe way the given file. If the file is an image you can wraps inside HTML img tag or an embed in case that file is, for example, a pdf.

{# your awesome twig template #}

<embed src="{{ bengor_file_download('file', 'pdf-file.pdf') }}" width="500" height="1000"/>

<img src="{{ bengor_file_download('image', 'image.jpg') }}"/>
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