checcoux / fm-elfinder-bundle
原始fm-elfinder-bundle的分支,包含aws s3连接器的acl规则
Requires
- php: ^7.2 || ^8.0
- ext-json: *
- studio-42/elfinder: ~2.1
- symfony/asset: ^4.4 || ^5.0 || ^5.2
- symfony/flex: 1.*
- symfony/form: ^4.4 || ^5.0 || ^5.2
- symfony/framework-bundle: ^4.4 || ^5.0 || ^5.2
- symfony/twig-bundle: ^4.4 || ^5.0 || ^5.2
Requires (Dev)
- matthiasnoback/symfony-config-test: ^4.0
- matthiasnoback/symfony-dependency-injection-test: ^4.1
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^8.5
- symfony/finder: ^4.4 || ^5.0 || ^5.2
- symfony/phpunit-bridge: ^4.1 || ^5.0 || ^5.2
Suggests
- barryvdh/elfinder-flysystem-driver: Flysystem driver for elfinder
- friendsofsymfony/ckeditor-bundle: FOSCKEditorBundle WYSIWYG Editor Bundle
- helios-ag/fm-summernote-bundle: FMSummernoteBundle WYSIWYG Editor Bundle
- helios-ag/fm-tinymce-bundle: FMTinyMCEBundle WYSIWYG Editor Bundle
- spatie/flysystem-dropbox: Dropbox 2 Driver for Flysystem
- 10.1
- dev-master / 10.0.x-dev
- 10.0.4
- 10.0.3
- 10.0.2
- 10.0.1
- 10
- 9.3.2
- 9.3.1
- 9.3
- 9.2.1
- 9.2
- 9.1.1
- 9.1
- 9
- 8.0.3
- 8.0.2
- 8.0.1
- 8.0
- 7.0.1
- 7.0
- 6.2.1
- 6.2
- 6.1.2
- 6.1.1
- 6.1
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0
- 5.3
- 5.2.1
- 5.2
- 5.1
- 5.0.5
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5
- 4.0.2
- 4.0.1
- 4.0
- 3.4
- 3.3
- 3.2.1
- 3.2
- 3.1
- 3.0
- 2.5.1
- 2.5
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.1
- v2.0
- 1.5
- 1.4.2
- 1.4.1
- 1.4
- 1.3
- 1.2
- 1.1
- 1.0
- dev-s3connector
- dev-symfony-bundle
- dev-command-test
This package is auto-updated.
Last update: 2024-09-20 00:17:50 UTC
README
原始fm-elfinder-bundle的分支,包含aws s3连接器的acl规则
FMElfinderBundle
ElFinder 在 Symfony 中的集成
代码质量保证
elFinder 是一个基于JavaScript和jQuery UI的Web开源文件管理器。其设计灵感来源于Mac OS X操作系统中使用的Finder程序,注重简洁和便捷。
推荐使用的包
目录
安装
步骤 1:安装
对于Symfony Flex安装,您需要启用社区食谱
composer config extra.symfony.allow-contrib true
安装
composer require helios-ag/fm-elfinder-bundle
将elfinder资源复制到公共文件夹
bin/console elfinder:install
步骤 2:启用包(可选)
在kernel中启用包(使用symfony flex时不需要)
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new FM\ElfinderBundle\FMElfinderBundle(), ); }
步骤 3:导入 FMElfinderBundle 路由文件
# app/config/routing.yaml elfinder: resource: "@FMElfinderBundle/Resources/config/routing.yaml"
步骤 4:配置您的应用程序的 security.yaml
使用 access_control 保护 ElFinder
# app/config/security.yaml security: //.... access_control: - { path: ^/efconnect, role: ROLE_USER } - { path: ^/elfinder, role: ROLE_USER }
基本配置
将配置选项添加到您的 config.yaml
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 relative_path: false #default true, will produce absolute urls to specified file(s) #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' #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 }
- default - elfinder 的实例,可以用来定义多个 ElFinder 配置,允许为项目中不同类型的 WYSIWYG 编辑器同时进行配置
- path - 定义 web/ 目录内文件的根目录,默认为 "uploads"。请确保为此目录设置适当的读写和所有权权限。
- url - 前缀到显示时图像路径的 URL,可以是
absolute或relative。如果是绝对路径,可以使用{homeFolder}字符串作为占位符,它将自动替换。如果是相对路径,它将与应用程序的基本 URL 前缀。如果为空,则 URL 将是基本 URL,并附加 'path' 参数的值 - driver - 可以是 LocalFileSystem、FTP 或 MySQL、Flysystem、S3 等,请参阅 FM\ElfinderBundle\DependencyInjection\Configuration 类
- locale - 区域设置确定 ElFinder 将使用哪种语言来翻译用户界面,默认是当前请求的区域设置
- cors_support - 允许跨域响应处理(默认为 false)
- editor - 确定要渲染的模板,以与 WYSIWYG 网页编辑器兼容,目前支持以下选项:"ckeditor"(与 FOSCKEditorBundle 或 TrsteelCkeditorBundle 一起使用),"fm_tinymce"(与 FMTinyMCEBundle 一起使用 tinymce4),"form"(表单类型),"simple"(独立)和 "custom"(自定义模板)。如何配置 CKEDitor 和 TinyMCE 以与该包一起使用,将在本文件的后续部分中解释。
- editor_template - 当编辑器设置为 "custom" 时,定义要渲染的模板。
- connector - 定义 elfinder 根目录选项的根节点。
- roots - 定义 "虚拟目录",它反映了项目中的目录。
- path_prefix - 启用相对路径的路径前缀,默认为斜杠 ('/')
- show_hidden - 显示以点 (.) 开头的文件和文件夹
- driver - 驱动类型,LocalFileSystem、Dropbox、FTP
- volume_id - (可选)在挂载卷时可以用来强制设置卷ID(默认自动递增)。如果提供,它必须是一个大于0的整数。
- alias - 目录别名
- path - 包含文件的目录
- upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
- upload_deny: ['all']
- upload_max_size: 2M
您可以在此处查看完整的根选项列表。要使用它们,请将驼峰式命名的选项名称转换为下划线命名。
通过实例使用多个上传文件夹
您可以通过实例配置设置多个上传根文件夹。
如果您已将实例配置为 /uploads 路径,当访问实例URL时,可以提供一个额外的文件夹作为主文件夹(例如,对于多用户应用程序)
/elfinder/{instance}/{homeFolder} 或 /efconnect/{instance}/{homeFolder}
例如,访问 /elfinder/acmeInstance/bob URL 将打开elfinder,以 /uploads/bob 作为根目录,其中只包含Bob的文件。
然后,访问 /elfinder/acmeInstance/alice URL 将重用您的实例,但将以 /uploads/alice 文件夹作为根目录打开elfinder,其中只包含Alice的文件。
要使用此功能,您必须在URL中提供实例名称,并且当然要确保设置主文件夹的适当读写权限。
注意:此功能仅适用于 LocalFileSystem 驱动。
我想设置更多一个主文件夹是否可能?
是的,您可以在fm_elfinder.yaml中的此配置中这样做
where_is_multi: {connector}: {连接器的索引} multi_home_folder: true folder_separator: {与/不同的一个字符}
示例
fm_elfinder:
instances:
default:
locale: fr # 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: https:/// # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/
fullscreen: false # default is true, applies to simple and ckeditor editors
where_is_multi:
roots: 0
multi_home_folder: true
folder_separator: "|"
#theme: smoothness # jquery theme, default is 'smoothness'
#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: "/var"
alias: Bibliothèque générale
upload_allow: ['all']
#upload_deny: ['all']
upload_max_size: 500M # also file upload sizes restricted in php.ini
attributes:
- {pattern: '..', read: true, write: true, locked: false}
#attributes: example of setting attributes permission
# - { pattern: '/(.*?)/', read: true, write: false, locked: true }