2017 © Pedro Peláez
 

library fal-filewriter

image

smichaelsen/fal-filewriter

  • Wednesday, August 16, 2017
  • by smichaelsen
  • Repository
  • 1 Watchers
  • 1 Stars
  • 695 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

FAL Filewriter Build Status

Little helper package for when you want to create files and save them to TYPO3's File Abstraction Layer, (*1)

Installation

FAL Filewriter is no TYPO3 extension and not available via TER. It can only be installed via composer:, (*2)

composer require smichaelsen/fal-filewriter, (*3)

Usage

FileGenerator

You need to create a class that provides the content that will be saved in a file. It has to implement the \Smichaelsen\FalFilewriter\FileGeneratorInterface, which is fairly easy., (*4)

Storage

By default your TYPO3 installation will have a storage record with uid 1 pointing to the fileadmin, but of course you can configure your own storage records pointing to other folders or even to external services like AWS., (*5)

Load the storage object like this:, (*6)

$storage = $this->objectManager->get(\TYPO3\CMS\Core\Resource\StorageRepository::class)->findByUid($fileStorageUid);

FileWriterService

The \Smichaelsen\FalFilewriter\FileWriterService has one public method saveFile() which takes the following parameters:, (*7)

  • $fileGenerator: Your file generator object implementing the FileGeneratorInterface.
  • $fileIdentifier: The file name which may include a relative path inside the $storage folder. The file extension may be omitted. Then it is read from the $fileGenerator (->getFileExtension()). If the file name starts with a path that doesn't exist it will be tried to create that path.
  • $storage: The ResourceStorage object to save the file in. See above ("Storage") for more information.

As return value you will receive a \TYPO3\CMS\Core\Resource\FileInterface object for the saved file., (*8)

Example:, (*9)

/** @var \Smichaelsen\FalFilewriter\FileWriterService $fileWriterService */
/** @var \Smichaelsen\FalFilewriter\FileGeneratorInterface $fileGenerator */
/** @var \TYPO3\CMS\Core\Resource\ResourceStorage $storage */
$fileObject = $fileWriterService->saveFile($fileGenerator, 'folder/my-filename', $storage);

The Versions

16/08 2017

dev-master

9999999-dev

  Sources   Download

GPL-2.0+

The Requires

 

16/08 2017

1.1.0

1.1.0.0

  Sources   Download

GPL-2.0+

The Requires

 

22/02 2017

1.0.4

1.0.4.0

  Sources   Download

GPL-2.0+

The Requires

 

22/02 2017

1.0.3

1.0.3.0

  Sources   Download

GPL-2.0+

The Requires

 

17/02 2017

1.0.2

1.0.2.0

  Sources   Download

GPL-2.0+

The Requires

 

17/02 2017

dev-task/travis-ci

dev-task/travis-ci

  Sources   Download

GPL-2.0+

The Requires

 

05/08 2016

1.0.1

1.0.1.0

  Sources   Download

GPL-2.0+

The Requires

 

01/08 2016

1.0.0

1.0.0.0

  Sources   Download

GPL-2.0+

The Requires