elendev/roxyfileman-bundle
Composer 安装命令:
composer require elendev/roxyfileman-bundle
包简介
Provides a Roxyfileman integration for your Symfony2 Project, mainly for ckeditor and tinymce.
README 文档
README
The bundle provide a Roxyfileman integration for Symfony2. It works well with IvoryCKEditorBundle.
Documentation
- Installation
- Configuration
- File location configuration
- Roxyfileman configuration
- Multiple profiles
- Advanced customization
- Custom filesystem service
- Custom version of Roxyfileman
- LICENSE
Installation
Require the bundle in your composer.json file:
{
"require": {
"elendev/roxyfileman-bundle": "~1.0"
}
}
Register the bundle :
// app/AppKernel.php public function registerBundles() { return array( new Elendev\RoxyFilemanBundle\ElendevRoxyFilemanBundle(), // ... ); }
Update composer :
$ composer update
Import the bundle's routes to your routing configuration file, e.g. routing.yml:
ElendevRoxyFilemanBundle:
resource: "@ElendevRoxyFilemanBundle/Resources/config/routing.yml"
prefix: /elendev-roxyfileman
The prefix can be changed. You can also add the path to the firewall to have the file manager service protected.
Configuration
RoxyFilemanBundle provide a simple configuration.
File location configuration
If you use the default LocalFileSystem (recommanded), this is the required configuration :
elendev_roxy_fileman: local_file_system: base_path: /path/to/your/file base_url: /url/to/the/base/path
The base_path parameter should be absolute. The base_url parameter is appended to the file name / relative file path to create its url.
The LocalFileSystem is used to access to a certain directory in the local file system. If you want to serve file from a distant server or located in database, you can take a look at the Custom filesystem service section.
Roxyfileman configuration
Every configuration options are available on the Roxyfileman configuration page.
elendev_roxy_fileman: conf: dirlist_route: elendev_roxyfileman_dir_list files_root: ...
The parameters have to be in lowercase.
Be careful : every url parameter available on the Roxyfileman configuration page should be used as a route here and the parameter have to be postfixed by _route. For example : the parameter DIRLIST becomes dirlist_route.
Multiple profiles
Above shows how the bundle work in single profile mode. Occasionally, you may need different file manager instances to manage different directories - imagine a CMS with a "album" and a "blog" module, and you don't want the "album" administrator to touch the files in the "blog" module. This is possible by telling the bundle to operate in multi-profile mode. Here's how:
elendev_roxy_fileman: profiles: # Triggers multi-profile mode album: # Name of the profile local_file_system: base_path: /path/to/album/directory base_url: /web/album/directory conf: integration: tinymce4 blog: local_file_system: base_path: /path/to/blog/directory base_url: /web/blog/directory conf: integration: tinymce4
Now we have two profiles defined, each with its own base path, URL settings, and configuration options.
The bundle needs to know which profile it should work on when its certain URL is accessed. One way is to add the profile placeholder to the routing config:
ElendevRoxyFilemanBundle: resource: "@ElendevRoxyFilemanBundle/Resources/config/routing.yml" prefix: /elendev-roxyfileman/{profile} requirements: profile: blog|album
Note: When profiles is not empty, the bundle will operate in multi-profile mode. conf, local_file_system and file_system_service_id values defined in the root configuration will be ignored.
Integration with rich text editor (CKEditor)
The original index path /fileman/index.html is served by the route elendev_roxyfileman_index in this bundle, and is what you need to integrate with rich text editors like CKEditor. For example:
<script>
$(function(){
CKEDITOR.replace( 'editor1', {
// Single profile mode
filebrowserBrowseUrl: '{{ path('elendev_roxyfileman_index') }}',
// To specify the profile name in multi-profile mode:
// filebrowserBrowseUrl: '{{ path('elendev_roxyfileman_index', { 'profile': 'blog' }) }}',
filebrowserImageBrowseUrl: '{{ path('elendev_roxyfileman_index') }}?type=image',
removeDialogTabs: 'link:upload;image:upload'
});
});
</script>
Using this bundle with egeloen/IvoryCKEditorBundle is really simple, a small modification to the ivory_ck_editor configuration do the job :
ivory_ck_editor:
default_config: default
configs:
default:
filebrowserBrowseRoute: elendev_roxyfileman_index
Advanced customization
Custom filesystem service
The filesystem service represent a file system for Roxyfileman. It is capable of serving files, file and directory trees, do operations on directories and files, ...
You can create a custom filesystem service by implementing the Elendev\RoxyFilemanBundle\FileSystem\FileSystemInterface and provide it as a service to the elendev_roxy_fileman parameter.
elendev_roxy_fileman: file_system_service_id: id_of_the_file_service
Custom version of Roxyfileman
The bundle comes with a version of Roxyfileman library. If you want to use a custom version, you can specify the path to the directory containing the index.html file to the roxyfileman_lib_path parameter.
elendev_roxy_fileman: roxyfileman_lib_path: /path/to/the/library
The library files are served by the Elendev\RoxyFilemanBundle\Controller\ResourcesController.php controller. It don't have to be publicly accessible.
LICENCE
The Elendev RoxyFileman BUndle is under the MIT license. For the full copyright and license information, please read the LICENSE file that was distributed with this source code.
A partial copy of Roxyfileman library is bundled with this bundle. The Roxyfileman library is under the GPLv3 license. A copy of the GPLv3 license was distributed with this source code.
elendev/roxyfileman-bundle 适用场景与选型建议
elendev/roxyfileman-bundle 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 8.59k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tinymce」 「CKEditor」 「roxyfileman」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 elendev/roxyfileman-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elendev/roxyfileman-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 elendev/roxyfileman-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Adds links to data objects in TinyMCE editor
TinyMCE Silverstripe 4 inspired theme
This nova package allows you to use CKEditor 4 for text areas.
Edit rich text content in Craft CMS using CKEditor.
A Laravel Package to integrate elFinder 2
统计信息
- 总下载量: 8.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-26