RichfileManager integration in Symfony
TravisCI | License | Version | Downloads |
---|---|---|---|
RichfileManager An open-source file manager. http://fm.devale.pro
Table of contents
Add FMRFMBundle to your composer.json
{
"require": {
"helios-ag/fm-rfm-bundle": "~1"
}
}
If you want to override default assets directory of Richfilemanager, add next option.
By default assets copied to web/assets/richfilemanager
or public/assets/richfilemanager
depending on Symfony version
{
"config": {
"rfm-dir": "web/assets/richfilemanager/"
}
}
Add composer script
"FM\\RFMBundle\\Composer\\RFMScriptHandler::copy",
to scripts section of 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"
]
}
}
Also you can copy assets manually. Copy dirs: 'config, 'images', 'languages', 'libs', 'src',
'themes' from vendor/servocoder/richfilemanager/
to your public assets directory
Now tell composer to download the bundle by running the command:
composer update helios-ag/fm-rfm-bundle
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new FM\RFMBundle\FMRFMBundle(),
);
}
# app/config/routing.yml
rfm:
resource: "@FMRFMBundle/Resources/config/routing.yml"
Secure RFM with access_control:
# 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 }
Example below (assumed that richfilemanager assets placed in web/assets/richfilemanager
directory)
fm_rfm:
instances:
default:
options:
serverRoot: true
fileRoot: /uploads
You can see the full list of roots options here. To use them, convert camelCased option names to snake_cased names.
Bundle provides custom form type, RFMType (provides same functionality as in FMElfinderBundle) and integration with CKEditor out of the box.