2017 © Pedro Peláez
 

library fileutility

File utility bundle

image

exploring/fileutility

File utility bundle

  • Friday, June 3, 2016
  • by jperovic
  • Repository
  • 1 Watchers
  • 3 Stars
  • 122 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 4 % Grown

The README.md

FileUtilityBundle

-, (*1)

This bundle aims to help management of files that were sent thought the form., (*2)

Symfony2 does a great job with converting raw file data into UploadedFile object and the goal of this bundle is to further extend it., (*3)

Installation (via composer)

To install FileUtilityBundle with Composer just add the following to your composer.json file:, (*4)

{
    // ...
    require: {
        "exploring/fileutility": "dev-master"
    }
}

Please replace the "dev-master" with some concrete release., (*5)

Then run:, (*6)

php composer.phar update

And register the bundle within AppKernel.php, (*7)

$bundles = array(
    ....
    new Exploring\FileUtilityBundle\ExploringFileUtilityBundle(),
);

You are all set., (*8)

Configuration

The bundle uses several configutaion entries. However, the minimalistic configuation should look like:, (*9)

exploring_file_utility:
    upload_root: %kernel.root_dir%/../web/uploads

All file are uploaded to a specific subdirectory of upload_root path. You can have as many subdirectories as you like., (*10)

You can read full configuration reference here., (*11)

Notice: Concept of directory "alias" has been removed in v2.0. Directories are now auto discovered during the warm up process. If you instantiate FileManager manually, you can still set available directories., (*12)

Advice: Either keep your upload root diretory out of web public directory or ensure proper access rights to file stored there in order to avoid execution of files uploaded., (*13)

Basic usage

You need to use service names exploring_file_utility.manager in order to gain access to FileManager:, (*14)

$file = ...; // instance of UploadedFile
$fileManager = $this->get('exploring_file_utility.manager');
$fileDescriptor = $fileManager->save($file, 'foo');
$fileManager->commit();

The example above takes some arbitrary file and, given the configuration above, uploads it to /path/to/symfonyapp/web/uploads/foo., (*15)

FileManager's operations are transaction based. That means that any changes made to the file-system will be reverted back unless you callcommit():, (*16)

You can invoke rollback() to revert any changes as well at any time:, (*17)

$fileManager->rollback();

Examples

Various examples, both simple and advances, can be found in example document, (*18)

Image manipulations

This bundle comes with some image manipulations operations built-in. Complete documentation on those can be found here, (*19)

The Versions

03/06 2016

dev-master

9999999-dev

File utility bundle

  Sources   Download

MIT

The Requires

 

10/02 2016

2.0.x-dev

2.0.9999999.9999999-dev

File utility bundle

  Sources   Download

MIT

The Requires

 

10/02 2016

2.0-beta3

2.0.0.0-beta3

File utility bundle

  Sources   Download

MIT

The Requires

 

10/02 2016

2.0-beta2

2.0.0.0-beta2

File utility bundle

  Sources   Download

MIT

The Requires

 

17/04 2015

2.0-beta

2.0.0.0-beta

File utility bundle

  Sources   Download

MIT

The Requires

 

18/07 2014

1.4

1.4.0.0

File utility bundle

  Sources   Download

MIT

The Requires

 

29/06 2014

1.3

1.3.0.0

File utility bundle

  Sources   Download

MIT

The Requires

 

24/06 2014

1.2

1.2.0.0

File utility bundle

  Sources   Download

MIT

The Requires

 

08/06 2014

1.1.1

1.1.1.0

File utility bundle

  Sources   Download

MIT

The Requires

 

08/06 2014

1.1

1.1.0.0

File utility bundle

  Sources   Download

MIT

The Requires

 

08/06 2014

1.0

1.0.0.0

File utility bundle

  Sources   Download

MIT

The Requires