Git Product home page Git Product logo

fmelfinderbundle's Introduction

FMElfinderBundle

ElFinder integration in Symfony

Code Quality Assurance

SL Insight TravisCI Coverage License Version
SensioLabsInsight Build Status Coverage Status Software License Latest Stable Version
Downloads
Total Downloads

elFinder is an open-source file manager for web, written in JavaScript using jQuery UI. Creation is inspired by simplicity and convenience of Finder program used in Mac OS X operating system.

Recommended bundles to use with:

FMTinyMCEBundle FOSCKEditorBundle TrsteelCkeditorBundle FMSummernoteBundle
FMTinyMCEBundle FOSCKEditorBundle TrsteelCkeditorBundle FMSummernoteBundle

Table of contents

Installation

Step 1: Installation

For Symfony Flex installation you need to enable community recipes:

  composer config extra.symfony.allow-contrib true

And install

  composer require helios-ag/fm-elfinder-bundle

Other way (non flex way) is to add FMElFinderBundle to your composer.json

{
    "require": {
        "helios-ag/fm-elfinder-bundle": "~9",
    }
}

also add component-dir under config node of composer.json

(also you can manually copy assets to this directory)

{
    "config": {
        "component-dir": "web/assets"
    }
}

Now tell composer to download the bundle by running the command:

composer update helios-ag/fm-elfinder-bundle

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FM\ElfinderBundle\FMElfinderBundle(),
    );
}

Step 3: Import FMElfinderBundle routing file

# app/config/routing.yml
elfinder:
     resource: "@FMElfinderBundle/Resources/config/routing.yml"

Step 4: Configure your application's security.yml

Secure ElFinder with access_control:

# app/config/security.yml
security:

    //....
    access_control:
        - { path: ^/efconnect, role: ROLE_USER }
        - { path: ^/elfinder, role: ROLE_USER }

Basic configuration

Add configuration options to your config.yml

fm_elfinder:
    #assets_path: / # default is /assets, this is where css/js elfinder files are
    instances:
        default:
            locale: %locale% # defaults to current request locale
            editor: ckeditor # other options are tinymce, tinymce4, fm_tinymce, form, simple, custom
            #editor_template: custom template for your editor # default null
            #path_prefix: / # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/
            #fullscreen: true|false # default is true, applies to simple and ckeditor editors
            #theme: smoothness # jquery theme, default is 'smoothness'
            include_assets: true # disable if you want to manage loading of javascript and css assets manually
            #visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg'] # only show these mime types, defaults to show all
            connector:
                #debug: true|false # defaults to false
                roots:       # at least one root must be defined, defines root filemanager directories
                    uploads:
                        #show_hidden: true|false # defaults to false, hides dotfiles
                        driver: LocalFileSystem
                        path: uploads
                        upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
                        upload_deny: ['all']
                        upload_max_size: 2M # also file upload sizes restricted in php.ini
                        #attributes: example of setting attributes permission
                        #    - { pattern: '/(.*?)/', read: true, write: false, locked: true }
  • assets_path - this is where css/js files of the bundle are, this options should be the same as composers component-dir option.
  • default - instance of elfinder, can be used to define multiple configurations of ElFinder, allows simultaneous configuration for different types of WYSIWYG editors in your project
  • path - define root directory for the files inside web/ directory, default is "uploads". Make sure to set proper write/read and owner permissions to this directory.
  • url - url to be prefixed to image path, for displaying. Can be either absolute or relative. If absolute, you can use {homeFolder} string as placeholder which will be replaced automatically. If relative, it will be prefixed with the applications base-url. If left blank, url will be the base-url, append with the value of the 'path' parameter
  • driver - can be LocalFileSystem, FTP or MySQL, Flysystem, S3 and etc, check class FM\ElfinderBundle\DependencyInjection\Configuration
  • locale - locale determines, which language, ElFinder will use, to translate user interface, default is current request locale
  • cors_support - allows cross domain responses handling (default false)
  • editor - determines what template to render, to be compatible with WYSIWYG web editor, currently supported options are: "ckeditor" (to use with FOSCKEditorBundle or TrsteelCkeditorBundle), "fm_tinymce" for tinymce4 (to use with FMTinyMCEBundle), "form" for form type, "simple" for standalone and "custom" for custom template. How to configure CKEDitor and TinyMCE to work with this bundle, will be explained further in this document.
  • editor_template - define template to render when editor is set to "custom".
  • connector - root node for defining options for elfinder root directories.
  • roots - define "virtual directories" that reflect directories in your project.
  • path_prefix - path prefix with relative_path enabled, default is slash ('/')
  • show_hidden - show files and folders that starts from . (dot)
  • driver - driver type, LocalFileSystem, Dropbox, FTP
  • volume_id - (optional) can be used to force a volume id when mounting volume (default auto-increments). If provided, it must be an integer bigger than 0.
  • alias - directory alias
  • path - directory that contains files
  • upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
  • upload_deny: ['all']
  • upload_max_size: 2M

You can see the full list of roots options here. To use them, convert camelCased option name to snake_case name.

Use multiple upload folder by instance

You can set multiple upload root folder by instance configuration.

If you have configured your instance with /uploads path, you can provide an additional folder as a home folder (e.g. for a multi-users application) when accessing to the instance URL :

/elfinder/{instance}/{homeFolder} or /efconnect/{instance}/{homeFolder}

For example, accessing to /elfinder/acmeInstance/bob URL will open up elfinder with /uploads/bob as root directory which only contains Bob's files.

Then, accessing to /elfinder/acmeInstance/alice URL will re-use your instance, but open up elfinder with /uploads/alice folder as root directory, containing only Alice's files.

To use this feature, you must provide the instance name in the URL, and of course be sure to set proper write/read permissions on home folders.

Note: this feature is only available with LocalFileSystem driver.

fmelfinderbundle's People

Contributors

helios-ag avatar ronan-lenor avatar hason avatar zeno-ce avatar danut007ro avatar thibmonier avatar dlancea avatar zorn-v avatar devantoine avatar snamor avatar phpmike avatar jdecool avatar bobvandevijver avatar lexxpavlov avatar pilip avatar rdohms avatar remmel avatar rehoehle avatar kix avatar nursultanturdaliev avatar vkalmuk avatar wouterb avatar nacholibre avatar bonswouar avatar dependabot[bot] avatar loostro avatar scollado avatar stiig avatar therosco avatar yowaiotoko avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.