chilldev/file-manager-bundle

File manager bundle for Symfony2.

This package's canonical repository appears to be gone and the package has been frozen as a result.


README

ChillDevFileManagerBundle is a Symfony2 bundle that provides file management features from your web application.

Build Status Scrutinizer Quality Score Coverage Status Dependency Status SensioLabsInsight

Installation

This bundle is provided as Composer package. To install it simply add following dependency definition to your composer.json file:

"chilldev/file-manager-bundle": "dev-master"

Replace dev-master with different constraint if you want to use specific version.

If you are using modern version of Symfony2, use dev-develop version instead of dev-master. (But this version isn't tested properly yet)

Note: This bundle requires PHP 5.4.

Note: You also need default templating engine installed and make sure all required bundles are also loaded in your application. See installation instructions for details about that.

Configuration

In order to use this bundle, load it in your kernel:

<?php

use ChillDev\Bundle\FileManagerBundle\ChillDevFileManagerBundle;

use Symfony\Component\HttpKernel\Kernel as BaseKernel;

class Kernel extends BaseKernel
{
    public function registerBundles()
    {
        $bundles = [
            new ChillDevFileManagerBundle(),
        ];
    }
}

Include bundle routes:

ChillDevFileManagerBundle:
    resource: "@ChillDevFileManagerBundle/Controller/"
    type: "annotation"
    prefix: "/filemanager"

And then configure your disks:

chilldev_filemanager:
    disks:
        disk_id:
            label: "Your filesystem"
            source: "/var/www/"

See configuration options for details.

Usage

Frontend

In general, ChillDevFileManagerBundle is end-user ready (or at least should be) component. However there can be some issues related to frontend presentation that you can be interested in (mainly JavaScript-related). For list of things you need to know to get best experience of this bundle UI see usage documentation.

Actions handlers

Another aspect which you may be interested in is implementing own file actions. You can easily extend ChillDevFileManagerBundle to allow additional file actions (even filetype-specific). You can bind your own action handler to specific MIME type by registring your instances of HandlerInterface interface:

class MyHandler implements HandlerInterface
{
    public function getLabel()
    {
        return 'My action';
    }

    public function supports($mimeType)
    {
        return preg_match('#^image/#', $mimeType) > 0;
    }

    public function handle(Request $request, Disk $disk, $path)
    {
        // handle action request
    }
}

You can read more detailed info here.

Extras

As a bonus, you can integrate ChillDevFileManagerBundle with SonataAdminBundle. You can read about how to do that in this section.

Resources

Contributing

Do you want to help improving this project? Simply fork it and post a pull request. You can do everything on your own, you don't need to ask if you can, just do all the awesome things you want!

This project is published under MIT license.

Authors

ChillDevFileManagerBundle is brought to you by Chillout Development.

List of contributors: