PHPackages                             fei/filer-common - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. fei/filer-common

ActiveLibrary

fei/filer-common
================

Flash applicative filer - common components

v2.0.2(7y ago)07.1k[2 PRs](https://github.com/flash-global/filer-common/pulls)1GPL-3.0PHP

Since Jan 25Pushed 2y ago24 watchersCompare

[ Source](https://github.com/flash-global/filer-common)[ Packagist](https://packagist.org/packages/fei/filer-common)[ RSS](/packages/fei-filer-common/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (26)Used By (1)

Filer Common
============

[](#filer-common)

[![GitHub license](https://camo.githubusercontent.com/518ffa50fed8eeb114e3e0cfe72c71764c753a5233628d04bfdc5d72117edba4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f666c6173682d676c6f62616c2f66696c65722d636f6d6d6f6e2e737667)](https://github.com/flash-global/filer-common)[![continuousphp](https://camo.githubusercontent.com/a226c3d271f36ea21de0a8731b51c4f7b965d4d28df7e85f79938072ac730844/68747470733a2f2f696d672e736869656c64732e696f2f636f6e74696e756f75737068702f6769742d6875622f666c6173682d676c6f62616c2f66696c65722d636f6d6d6f6e2e737667)](https://camo.githubusercontent.com/a226c3d271f36ea21de0a8731b51c4f7b965d4d28df7e85f79938072ac730844/68747470733a2f2f696d672e736869656c64732e696f2f636f6e74696e756f75737068702f6769742d6875622f666c6173682d676c6f62616c2f66696c65722d636f6d6d6f6e2e737667)[![Build Status](https://camo.githubusercontent.com/b0f72906805759e984313d520d96267849044a5f333e717b45e279706b588cac/68747470733a2f2f7472617669732d63692e6f72672f666c6173682d676c6f62616c2f66696c65722d636f6d6d6f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/flash-global/filer-common)[![GitHub issues](https://camo.githubusercontent.com/3a32b4f044619e4f99f3bc04814afef1f46b1ecd5c19ea0c87e2c16cc9d13292/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f666c6173682d676c6f62616c2f66696c65722d636f6d6d6f6e2e737667)](https://github.com/flash-global/filer-common/issues)

This is the Filer Common elements package which contains:

- File Entity and transformer
- File Entity validator
- Context Entity and transformer
- Context Entity validator
- Related classes

Installation and Requirement
============================

[](#installation-and-requirement)

Filer Client needs **PHP 5.5** or higher.

Add this requirement to your `composer.json`: `"fei/filer-common": : "^1.0"`

Or execute `composer.phar require fei/filer-common` in your terminal.

Usage
=====

[](#usage)

Entities and classes
--------------------

[](#entities-and-classes)

### File entity

[](#file-entity)

In addition to traditional ID and CreatedAt fields, File Entity has **six** important properties:

PropertyTypeuuid`string`revision`integer`category`integer`contentType`string`data`string`filename`string`file`SplFileObject`contexts`ArrayCollection`- `$uuid` (Universal Unique Identifier) is a **unique id** corresponding to a file. Its format is based on **36 characters** as defined in `RFC4122` prefixed by a **backend id** and separated by a `:`. Example: `bck1:f6461366-a414-4b98-a76d-d7b190252e74`
- `revision` is an integer indicating the file's current revision.
- `category` is an integer defining in which database the file will be stored in.
- `contentType` defines the content type of the `File` object.
- `data` contains the file's content.
- `filename` contains the file's filename.
- `file` is an `SplFileObject` instance. (see  for more details)
- `contexts` is an `ArrayCollection` instance where each element is a Context entity

### Context entity

[](#context-entity)

In addition to traditional ID field, Context Entity has **three** important properties:

PropertyTypekey`string`value`string`file`File`- `key` is a string defining the context's key.
- `value` is a string defining the context's value
- `file` is a File object indicating the context's related file

Other tools
-----------

[](#other-tools)

### File validator

[](#file-validator)

You have the possibility to validate a `File` entity with `FileValidator` class:

```
