Download the PHP package fei/filer-common without Composer
On this page you can find all versions of the php package fei/filer-common. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package filer-common
Filer Common
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
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
Entities and classes
File entity
In addition to traditional ID and CreatedAt fields, File Entity has six important properties:
| Property | Type |
|---|---|
| uuid | 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 inRFC4122prefixed by a backend id and separated by a:. Example:bck1:f6461366-a414-4b98-a76d-d7b190252e74revisionis an integer indicating the file's current revision.categoryis an integer defining in which database the file will be stored in.contentTypedefines the content type of theFileobject.datacontains the file's content.filenamecontains the file's filename.fileis anSplFileObjectinstance. (see https://secure.php.net/manual/en/class.splfileobject.php for more details)contextsis anArrayCollectioninstance where each element is a Context entity
Context entity
In addition to traditional ID field, Context Entity has three important properties:
| Property | Type |
|---|---|
| key | string |
| value | string |
| file | File |
keyis a string defining the context's key.valueis a string defining the context's valuefileis a File object indicating the context's related file
Other tools
File validator
You have the possibility to validate a File entity with FileValidator class:
By default, all File properties must not be empty,
but you're also able to validate only a few properties of your entity, using validate methods:
Context validator
You have the possibility to validate a Context entity with ContextValidator class:
By default, all Context properties must not be empty,
but you're also able to validate only a few properties of your entity, using validate methods: