2017 © Pedro Peláez
 

symfony-bundle file-system-bundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

image

prolix/file-system-bundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  • Thursday, July 13, 2017
  • by kuldippujara
  • Repository
  • 2 Watchers
  • 0 Stars
  • 43 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 16 Versions
  • 10 % Grown

The README.md

KitpagesFileSystemBundle

This is a Symfony2 bundle that provides a filesystem abstraction layer. Basicaly this does the same as the gaufrette library from KnpLabs, but it manages much more efficiently big files. We can manage a 2GB file with a memory limit of 128Mo for the PHP process. We never transfert the entire content in a $content variable., (*1)

With this bundle you can save your files on different filesystems (S3, Local filesystem, FTP,...), (*2)

Some elements of the configuration system are based on the code of the KnpGaufretteBundle., (*3)

Versions

2019-01-23 : v4.0.0, (*4)

  • [new] upgrade to Symfony 2.8, 3.x, 4.x
  • [doc] best doc for tests

2018-05-16 : v3.2.1, (*5)

  • [fix] url of the file in the flysystem system for swift
  • [fix] fix pb when the file doesn't exist in flysystem adapter
  • [fix] fix mime type problem in flysystem adapter

2018-05-15 : v3.2.0, (*6)

  • [new] integration with flysystem

Lot of doc is missing here..., (*7)

2012-05-24 : v1.0.0 * first stable release, (*8)

Actual state

This bundle is stable. The adapters are :, (*9)

  • Local adapter : file system of the server
  • S3 adapter : for Amazon Web Service AWS S3
  • FTP adapter : for FTP access
  • FlySystem adapater : for a link to flysystem

Installation

You need to add the following lines in your deps :, (*10)

Using Composer, just $ composer require kitpages/file-system-bundle package or:, (*11)

``` javascript { "require": { "kitpages/file-system-bundle": "dev-master" } }, (*12)


Only if you use AmazonS3 ``` javascript { "require": { amazonwebservices/aws-sdk-for-php: ~1.5 } }

Only if you use Flysystem ``` javascript { "require": { "league/flysystem": "^1.0", "oneup/flysystem-bundle": "^1.14", } }, (*13)

AppKernel.php

```php
$bundles = array(
    ...
    new Kitpages\FileSystemBundle\KitpagesFileSystemBundle(),
);

// AWS SDK needs a special autoloader, (*14)

require_once __DIR__.'/../vendor/aws-sdk/sdk.class.php';

Configuration example

The following configuration defines 3 filesystems :, (*15)

  • kitpagesFile : a local filesystem
  • kitpagesAmazon : a filesystem on Amazon S3
  • kitpagesFlysystem : another filesystem abstraction

Let's see the configuration in config.yml, (*16)

kitpages_file_system:
    file_system_list:
        kitpagesFile:
            local:
                directory_public: %kernel.root_dir%/../web
                directory_private: %kernel.root_dir%
                base_url: %base_url%
        kitpagesAmazon:
            amazon_s3:
                bucket_name: %kitpagesFile_amazons3_bucketname%
                key: %kitpagesFile_amazons3_key%
                secret_key: %kitpagesFile_amazons3_secretkey%
        kitpagesFlysystem:
            flysystem:
                flysystem_adapter: oneup_flysystem.your_filesystem
                file_uri_prefix: https://your.custom.url/4687311687643/FRA/

Usage example

// use AdapterFile at the beginning of the file
use Kitpages\FileSystemBundle\Model\AdapterFile;

// get the adapter
$localAdapter = $this->get("kitpages_file_system.file_system.kitpagesFile");
$s3Adapter = $this->get("kitpages_file_system.file_system.kitpagesAmazon");

// private files (without direct public URL)
$adapter->copyTempToAdapter("/my_physical_dir/foo.txt", new AdapterFile("bar/foo.txt") );
$adapter->copyAdapterToTemp(new AdapterFile("bar/foo.txt"), "/my_physical_dir/foo.txt" );

// public files (with a direct URL given by the adapter)
$adapter->copyTempToAdapter("/my_physical_dir/foo.txt", new AdapterFile("bar/foo.txt", true) );
$url = $adapter->getFileLocation(new AdapterFile("bar/foo.txt", true));

// some functions of the adapter :
$adapterFile = new AdapterFile("bar/foo.txt");
$adapter->copyTempToAdapter("/my_physical_dir/foo.txt", $adapterFile );
$content = $adapter->getFileContent($adapterFile);
$adapter->sendFileToBrowser($adapterFile);
if ($adapter->isFile($adapterFile) ) {
    // if file exists in the adapter
}

Run the tests

cd Tests/app/web
php -S localhost:8888

The Versions

13/07 2017

dev-master

9999999-dev https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

13/07 2017

v3.1.3

3.1.3.0 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

26/09 2013

v3.1.2

3.1.2.0 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

13/09 2013

v3.1.1

3.1.1.0 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

09/09 2013

v3.1.0

3.1.0.0 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

04/06 2013

v3.0.0

3.0.0.0 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

15/05 2013

2.1.x-dev

2.1.9999999.9999999-dev https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

15/05 2013

v2.1.0

2.1.0.0 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

12/10 2012

v2.1.0RC1

2.1.0.0-RC1 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

10/10 2012

v2.1.0BETA5

2.1.0.0-beta5 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

10/10 2012

v2.1.0BETA4

2.1.0.0-beta4 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

09/10 2012

v2.1.0BETA3

2.1.0.0-beta3 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

09/10 2012

v2.1.0BETA2

2.1.0.0-beta2 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

08/10 2012

v2.1.0BETA1

2.1.0.0-beta1 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

01/10 2012

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer

01/10 2012

v2.0

2.0.0.0 https://github.com/kitpages/KitpagesFileSystemBundle

Symfony Kitpages FileSystem Bundle. Abstraction layer for files (local, S3)

  Sources   Download

BSD

The Requires

 

by Sebastien Lefebvre

filesystem gaufrette file abstraction layer