izapbrasil/fm-rfm-bundle

FMRichfilemanager 扩展包,为您的 Symfony 项目添加 Richfilemanager 文件管理器

安装: 5

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 1

类型:symfony-bundle


README

RichfileManager 集成到 Symfony

代码质量保证

RichfileManager 一个开源文件管理器。 http://fm.devale.pro

目录

安装

步骤 1:安装

将 FMRFMBundle 添加到您的 composer.json

{
    "require": {
        "helios-ag/fm-rfm-bundle": "~1"
    }
}

如果您想覆盖 Richfilemanager 的默认资产目录,请添加以下选项。默认情况下,资产复制到 web/assets/richfilemanagerpublic/assets/richfilemanager,具体取决于 Symfony 版本

{
    "config": {
        "rfm-dir": "web/assets/richfilemanager/"
    }
}

添加 composer 脚本

"FM\\RFMBundle\\Composer\\RFMScriptHandler::copy",

到 composer.json 的脚本部分

{
  "scripts": {
      "symfony-scripts": [
          "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
          "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
          "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
          "FM\\RFMBundle\\Composer\\RFMScriptHandler::copy",
          "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
          "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
          "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
      ]
    }
}

您也可以手动复制资产。将 'config', 'images', 'languages', 'libs', 'src', 'themes' 目录从 vendor/servocoder/richfilemanager/ 复制到您的公共资产目录

现在运行以下命令让 composer 下载扩展包

composer update helios-ag/fm-rfm-bundle

步骤 2:启用扩展包

在 kernel 中启用扩展包

<?php
// app/AppKernel.php

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

步骤 3:导入 FMRFMBundle 路由文件

# app/config/routing.yml
rfm:
     resource: "@FMRFMBundle/Resources/config/routing.yml"

步骤 4:配置您应用程序的 security.yml

使用 access_control 保护 RFM

# app/config/security.yml
security:

    //....
    access_control:
        - { path: ^/rfm_show, role: ROLE_USER }
        - { path: ^/rfm_run, role: ROLE_USER }
        - { path: ^/rfm_config.json, role: ROLE_USER }
        - { path: ^/rfm_config_default.json, role: ROLE_USER }

基本配置

将配置选项添加到您的 config.yml

以下示例(假设 richfilemanager 资产放置在 web/assets/richfilemanager 目录)

fm_rfm:
    instances:
        default:
            options:
                serverRoot: true
                fileRoot: /uploads

您可以在这里查看完整的根选项列表 这里。要使用它们,将 camelCased 选项名称转换为 snake_cased 名称。

扩展包提供了自定义表单类型 RFMType(与 FMElfinderBundle 提供的功能相同)以及与 CKEditor 的集成。