2017 © Pedro PelĂĄez
 

symfony-bundle gaufrette-browser-bundle

This bundle provides an integration of the KnpMenu library

image

digitalkaoz/gaufrette-browser-bundle

This bundle provides an integration of the KnpMenu library

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Gaufrette Browser

Build Status Total Downloads Latest Stable Version Code Coverage Scrutinizer Quality Score SensioLabsInsight, (*1)

This Bundle allows you to browse a Gaufrette Filesystem like a Doctrine Connection. It tries to wrap Doctrine ObjectRepositories and Entities around Gaufrette Files., (*2)

Installation

Install it with Composer, (*3)

``` json { "require" : { "digitalkaoz/gaufrette-browser-bundle" : "dev-master@dev" } }, (*4)


**Active the Bundle in your Kernel** ``` php // application/AppKernel.php public function registerBundles() { return array( // ... new rs\GaufretteBrowserBundle\rsGaufretteBrowserBundle(), // ... ); }

Import the Routing, (*5)

``` yml rs_gaufrette_browser: resource: "@rsGaufretteBrowserBundle/Resources/config/routing.xml" prefix: /gaufrette/browser, (*6)


Configuration ------------- **Create a Gaufrette Filesystem (see https://github.com/KnpLabs/KnpGaufretteBundle for more Installation and Configuration)** ``` yml knp_gaufrette: adapters: default: local: directory: /your/path/ filesystems: default: adapter: default alias: default_filesystem stream_wrapper: ~

Connect the Browser to the Filesystem, (*7)

``` yml rs_gaufrette_browser: filesystem: default_filesystem #the gaufrette filesystem alias to use, (*8)



**The Full Config Reference** ``` yml rs_gaufrette_browser: file_pattern: "/\.(jpg|gif|jpeg|png)$/" # a valid regular expression to filter for file-extensions filesystem: default_filesystem # the gaufrette filesystem alias to use file_class: Your\File\Class # should extend rs\GaufretteBrowserBundle\Entity\File directory_class: Your\Directory\Class # should extend rs\GaufretteBrowserBundle\Entity\Directory

Usage

Goto http://your.domain/gaufrette/browser and browse the filesystem, (*9)

Querying for Directories or Files, (*10)

Using the Repository Implementations:, (*11)

``` php $this->get('rs_gaufrette_browser.repository.directory')->findBy(array('prefix'=>'/foo')); #only search folders that starts with /foo $this->get('rs_gaufrette_browser.repository.file')->findBy(array('suffix'=>'/.xls/')); #only search .xls files $this->get('rs_gaufrette_browser.repository.file')->find('/foo/bar.png'); #find one file $this->get('rs_gaufrette_browser.repository.file')->findOneBy(array('prefix'=>'/foo', 'suffix' => '/.xls/')); #find one file named /foo/*.xls, (*12)


**Using the ParamConverters** Using ParamConverters for `Directory` and `File` is quiet simple: ``` php /** * @ParamConverter("folder", class="rs\GaufretteBrowserBundle\Entity\Directory", options={"id" = "slug"}) */ public function myCustomDirectoryAction(Request $request, Directory $folder){} /** * @ParamConverter("file", class="rs\GaufretteBrowserBundle\Entity\File", options={"id" = "slug"}) */ public function myCustomFileAction(Request $request, File $file){}

Hooking into Events, (*13)

Everything inside the Controller-Actions is build up with Events., (*14)

The following Events exists, (*15)

``` php final class GaufretteBrowserEvents { const DIRECTORY_SHOW = 'gaufrette.directory.show'; const DIRECTORY_INDEX = 'gaufrette.directory.index';, (*16)

const FILE_SHOW = 'gaufrette.file.show';
const FILE_INDEX = 'gaufrette.file.index';

}, (*17)


**Hook your own Functionality into default Controllers** implement the Subscriber ``` php class MyEventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { return array( GaufretteBrowserEvents::DIRECTORY_INDEX => 'myCustomAction' ); } public function myCustomAction(DirectoryControllerEvent $event) { $event->addDirectory($myCustomDirectory); $event->removeDirectory($unwantedDirectory); $event->addTemplateData('myCustomVar', 'foobar'); } }

and TAG the Service, (*18)

``` xml , (*19)



Tests ----- everything is well unit tested: ``` sh phpunit

view builds on Travis: https://travis-ci.org/digitalkaoz/GaufretteBrowserBundle, (*20)

TODO

  • better Tree Initialization of Directories (maybe https://github.com/KnpLabs/materialized-path)
  • Javascript-Tree to Browse Files more sophisticated (maybe http://jquery.bassistance.de/treeview/demo/)
  • better File Detail Pages
  • functional Tests
  • allow more gaufrette-filesystem instances
  • more powerful Repository Queries

The Versions

05/02 2015

dev-master

9999999-dev

This bundle provides an integration of the KnpMenu library

  Sources   Download

MIT

The Requires

 

The Development Requires

filesystem browser gaufrette

17/11 2014

0.3.0

0.3.0.0

This bundle provides an integration of the KnpMenu library

  Sources   Download

MIT

The Requires

 

The Development Requires

filesystem browser gaufrette

11/06 2014

0.2

0.2.0.0

This bundle provides an integration of the KnpMenu library

  Sources   Download

MIT

The Requires

 

The Development Requires

filesystem browser gaufrette

11/06 2014

0.1

0.1.0.0

This bundle provides an integration of the KnpMenu library

  Sources   Download

MIT

The Requires

 

The Development Requires

filesystem browser gaufrette