2017 © Pedro Peláez
 

library fs

SamsonPHP file system service

image

samsonphp/fs

SamsonPHP file system service

  • Tuesday, August 30, 2016
  • by samsonphp
  • Repository
  • 2 Watchers
  • 3 Stars
  • 3,329 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 19 Versions
  • 0 % Grown

The README.md

SamsonPHP File service

Latest Stable Version Build Status Code Coverage Scrutinizer Code Quality Stories in Ready Total Downloads, (*1)

This module gives abstraction level for working with file system independently of what exact file system is being used., (*2)

Configuration

The main goal is to configure the $fileServiceClassName service parameter., (*3)

This is usually done using SamsonPHP module/service configuration, (*4)

By default $fileServiceClassName is set to samsonphp\fs\LocalFileService - it uses standard local file system service. This parameter has to be set to file service class name, for example - local file service - samsonphp\fs\LocalFileService, no module/service identifiers or anything else should be used, first namespace separator \ should be avoided too: * \samsonphp\fs\LocalFileService - incorrect * samsonphp\fs\LocalFileService - correct, (*5)

When service is initialized it checks if configured file service class is present otherwise fatal error is signaled., (*6)

This gives you ability, for example, to quickly change your web-application file system from local file system to Amazon Web Services S3 bucket, which is implemented by SamsonPHP AWS file service fs_aws. All you have to do is add configuration for this SamsonPHP file service(fs):, (*7)

class FileServiceConfig extends \samson\core\Config 
{
  /**@var string Configured module/service identifier */
  public $__id = 'fs';

  /**@var string Set Amazon Web Services as web-application file service using its identifier */
  public $fileServiceID = 'samsonphp\fs\AWSFileService';
}

Usage

To work with this SamsonPHP file service you should get file service instance pointer:, (*8)

/**@var \samsonphp\fs\FileService $fs Pointer to file service */
$fs = & m('fs');

After this you can use all available methods from AbstractFileService interface, which this SamsonPHP file service(fs) implements. All this method call act like a proxy and passes them to currently configured file service(by default php_fs_local)., (*9)

Example usage:, (*10)

if (!$fs->exists(...)) {
  $fs->write(...);
}

Using service in tests

First of all you should create service instance:, (*11)

// Create instance
$this->fileService = new FileService(__DIR__.'../');

In other places called after service creation you should retrieve service object via factory method:, (*12)

// Get instance using services factory as error will signal other way
$this->fileService = \samson\core\Service::getInstance('samsonphp\fs\FileService');

All other SamsonPHP modules must and use this file service approach when working with files., (*13)

The Versions

30/08 2016

dev-master

9999999-dev http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

22/01 2015

1.1.11

1.1.11.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

14/01 2015

1.1.10

1.1.10.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

13/01 2015

1.1.9

1.1.9.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

13/01 2015

1.1.8

1.1.8.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

11/01 2015

1.1.7

1.1.7.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

10/01 2015

1.0.13

1.0.13.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

18/12 2014

1.1.6

1.1.6.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

18/12 2014

1.1.5

1.1.5.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

18/12 2014

1.1.4

1.1.4.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

17/12 2014

1.1.3

1.1.3.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

11/12 2014

1.1.2

1.1.2.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

11/12 2014

1.1.1

1.1.1.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

09/12 2014

1.1.0

1.1.0.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

08/12 2014

1.0.4

1.0.4.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

07/12 2014

1.0.3

1.0.3.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

07/12 2014

1.0.2

1.0.2.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

25/11 2014

1.0.1

1.0.1.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp

23/11 2014

1.0.0

1.0.0.0 http://samsonos.com/

SamsonPHP file system service

  Sources   Download

Open Software License (OSL) v 3.0

The Requires

 

The Development Requires

by Vitaly Iegorov
by Onysko Pavlo

file system samsonphp