Download the PHP package magicmonkey/metasya without Composer

On this page you can find all versions of the php package magicmonkey/metasya. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package metasya

Metasya

Metasya is a library allowing the management of embarked metadatas on diverse types of files, to manage the import of metadatas in an information system and the synchronization of the data between the information system and files with exiftool.

What is Exiftool ? Take a look here : https://www.sno.phy.queensu.ca/~phil/exiftool/

[TOC]

Install

  1. You have to use Composer, a tool for dependency management in PHP :

    Metasya is enregistred as package on Packagist : https://packagist.org/packages/magicmonkey/metasya

  2. To activate the autoloader, you may need to type the following command into the command line :

  3. With operating system based on UNIX, the provided version of Exiftool by Metasya at least must have the execute permission for the owner :

  4. You can write in a file like index.php a code that tests if Metasya that you have just downloaded really works :

Usage : Here we go !

The MetadataHelper

The MetadataHelper is the main class of Metasya.

Create the object

In order to manage metadata of a file you have to create a new MetadataHelper object with the path of the file.

Use the exiftool version installed on your computer

By default, Metasya uses the provided exiftool. However it's possible to use the one installed on your computer in two different ways :

Display errors

By default, Metasya displays errors returned by the tool Exiftool. However it's possible to not display it :

Version information

Various functions are available in order to get information about the version of exiftool.

Change the path of the file

If you have to change the path of the file, you can proceed as described bellow :

Execute his own exiftool command line

The next part is about taskers which allow you to manage files metadata thanks predefined commands. However, you can use the function "execute" in order to do specifically what you really want regardless of the path of the file given as parameter to the object metadataHelper.

Generate Sidecar file

Sidecar files, also known as buddy files or connected files, are computer files that store data (often metadata which is not supported by the format of a source file.

Note that by default the output path of the generated sidecar file is the folder which is called "metasya/Sidecar" and it's created at the root of your project. However you can specify an other path like this :

Notion of Taskers

The MetadataHelper object has several Taskers. Each Tasker brings features thanks the use of exiftool.

ReaderTasker

The ReaderTasker allows to read file's metadata. You can use 3 features which are :

read (\$selectedMetadata, \$excludedMetadata) :
readByGroup (\$selectedMetadata, \$num, \$excludedMetadata) :
readWithPrefix (\$selectedMetadata, \$num, \$excludedMetadata) :

WriterTasker

The WriterTasker allows to add metadata to a file or to edit file's metadata. You can use 3 features which are :

write (\$targetedMetadata, \$replace, \$overwrite) :
writeFromJsonFile (\$jsonFilePath, \$replace, \$overwrite) :
writeFromJson (\$json, \$replace, \$overwrite) :

EraserTasker

The EraserTasker allows to remove file's metadata. Only one feature is available at this moment :

remove ($targetedMetadata, \$excludedMetadata, \$overwrite) :

The system of schemata

Metasya offers a system of schemata in order to easly manage metadata of files.

How to add a custom schema as JSON file

Note that you have the possibility to create your own schemata and to stock them in the desired folder. Thus, schemeta created in a project can be used in an other one !

! Note : the name of a personal schema must ends with "-schema.json". Example of a valid name : cosmos-schema.json.

Example of a valid schema as JSON file
Description & rules of the structure

Respect the following rules in order to create a valid schema as JSON file. Note that if a JSON file is not valid, the schema object will be created but it will not be usable.

JSON key Description Rules Required
shortcut The shortcut is a label which refers to a schema or a metadata. It must be unique.
description Describe the schema or a metadata.
metadata This JSON array contains several metadata grouped by namespace. It must be a JSON array.
metadata[namespace] Corresponds to the namespace of the group of metadata.
metadata[list] The list of metadata with their shortcut.
type Corresponds to the type of value that the metadata accepts. It must corresponds to a PHP class which implements the interface MetaTypeInterface. If you want to use the MetaTypeString class, just write "String".

Types of metadata

The default type of a metadata is an instance of the class MetaTypeAny. This last one accepts any type of value. By specifying the type of metadata, the new value of a metadata will be checked before to be added. If this last one is not accepted, it's not added.

The list of types of metadata
Class JSON shortcut Description
MetaTypeAny Any Accepts any type of values.
MetaTypeString String Accepts only string values.
How to create his own type of metadata

How to use schemata with taskers

Note that for every following examples, the above schema example called "cosmos" will be used.

How to read

You can read all schema's metadata by passing its shortcut or the schema as object. You can also read only some metadata of the schema in same ways.

Let's see an example :

How to write

You can add or edit metatdata without knowing namespace and metadata tag. Indeed, the system of schemata allows to use the shortcut of schemata's metadata like following :

How to delete

As the method to read, you can remove all schema's metadata by passing its shortcut or the schema as object. You can also remove only some metadata of the schema in same ways.

The SchemataManager

First you need to know that the SchemataManager is a singleton : it means that only one instance of this class can be created. How it works ? The SchemataManager will automotically convert all the JSON file inside the both directory user and default shemata to schema objects. Next these schema objects will be added to the list of schemata of the SchemataManager.

You can get this manager like following :

or directly via the MetadataHelper class :

Get all schemata as objects (default and user)
Get all valid schemata as objects (default and user)
The path of the user's schemata's folder

By default, the user's schemata's folder is called "metasya/Schemata" and it's created at the root of your project. However, you can change it like following :

If the old folder "metasyaSchemata" contains json files as schemata, all these files will be copied inside the new folder. Next, if you want to delete the folder "metasyaSchemata" and it's content, you can do it manually (safe and secure) or you can ask to Metasya to do it automatically. Indeed, you can inform a boolean with the value "true" as parameter which indicates to remove the older folder and it's content after the copy :

You can get the user's schemata's folder for information like this :

Test if a string is a shortcut of schema

You can test if a string is associated to a schema with the function isSchemaShortcut(). This last one return true of false according the shortcut value given as parameter :

Get a schema as object from its shortcut

You can get a schema as object with the function getSchemaFromShortcut() :

Test if a string is a shortcut of metadata

You can test if a string is associated to a metadata with the function isMetadataShortcut(). This last one return true of false according the shortcut value given as parameter. Note that only metadata from valid schemata are tested.

Get a metadata as object from its shortcut

You can get a metadata as object with the function getMetadataFromShortcut(). Note that only metadata from valid schemata are tested.

Check the state of schemata

It can be useful to check the state of schemata in order to be aware of possible errors. In the example below, the first one schema identified by "USER-xmp" isn't valid, contrary to to the second one identified by "cosmos".

The class Metadata

A Metadata object corresponds to a metadata tag. You can create a Metadata according to its tag name, its namespace, its shortcut, it's description and it's type (in this order). Let's see an example :

Note that by default the type of a Metadata will be the type MetaTypeAny and the description of a Metadata is null.

The class Schema

A Schema object is mainly constituted by a shortcut, a description and a list of metadata. The shortcut allows to make a reference to the schema.

Get the list of metadata
Get the list of metadata as targeted metadata
Add and remove metadata to a schema

Obviously you can add and remove a metadata to a schema like following :

Test if a string is a shortcut of metadata of the schema

You can test if a string is associated to a metadata of the schema with the function isMetadataShortcut(). This last one return true of false according the shortcut value given as parameter. Note that the schema must be valid.

Get a metadata as object from its shortcut

You can get a metadata fo the schema as object with the function getMetadataFromShortcut(). Note that the schema must be valid.

The list of defaults schemata

comming soon ...


All versions of metasya with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package magicmonkey/metasya contains the following files

Loading the files please wait ....