PHP Classes

PHP PRONOM drip: Recognize file formats using PRONOM registry

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 103 All time: 9,767 This week: 488Up
Version License PHP version Categories
drip 1.0.0GNU General Publi...5.2PHP 5, Files and Folders, Parsers
Description 

Author

This package recognize file formats and versions using the PRONOM registry.

It uses the PRONOM registry developed by the Digital Preservation Department of the National Archives of the United Kingdom to identify format and version of a file or a stream of data

The class uses a DROID utility signature file that can be downloaded on their web site.

Innovation Award
PHP Programming Innovation award nominee
April 2015
Number 13
Many applications generate files in custom formats that may be hard to recognize without knowledge of the way the data is structured in the files.

This class provides a solution to recognize many types of file formats using the PRONOM file format signature registry.

Manuel Lemos
Picture of Cyril Vazquez
  Performance   Level  
Name: Cyril Vazquez <contact>
Classes: 1 package by
Country: France France
Age: ???
All time rank: 4406110 in France France
Week rank: 164 Up7 in France France Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php
/*
 * Copyright (C) 2015 Maarch
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'drip.php';
require_once
'abstractSequence.php';
require_once
'abstractFragment.php';
require_once
'leftFragment.php';
require_once
'rightFragment.php';
require_once
'subSequence.php';
require_once
'byteSequence.php';
require_once
'internalSignature.php';
require_once
'format.php';

$drip = new drip(__DIR__ . DIRECTORY_SEPARATOR . 'signatureFiles' . DIRECTORY_SEPARATOR . 'DROID_SignatureFile_V78.xml');

$fileResource = $drip->file(__FILE__);

$streamResource = $drip->buffer(file_get_contents('http://www.google.fr'));
$drip->loadSignaturefile(__DIR__ . DIRECTORY_SEPARATOR . 'signatureFiles' . DIRECTORY_SEPARATOR . 'DROID_SignatureFile_V78.xml');
$streamResource2 = $drip->buffer(file_get_contents('http://www.google.fr'));
echo
"<pre>";
print_r($fileResource);
print_r($streamResource);

print_r($streamResource2);
echo
"</pre>";


Details

You can download the latest DROID Signature File at http://www.nationalarchives.gov.uk/aboutapps/pronom/droid-signature-files.htm Basic use: - require class scripts - instanciate new drip, providing with a Droid Signature file path - use drip::file to get the format identification for a file - use drip::buffer to get the format from a stream contents

  Files folder image Files (12)  
File Role Description
Accessible without login Plain text file README Doc. README
Plain text file abstractFragment.php Class Abstract class for right and left fragments
Plain text file abstractSequence.php Class Abstract class for byte sequences
Plain text file byteSequence.php Class Byte sequence class
Plain text file drip.php Class The main drip class
Accessible without login Plain text file example.php Example Example script
Plain text file format.php Class Class for formats
Plain text file internalSignature.php Class Internal Signature class
Plain text file leftFragment.php Class Left fragment class
Accessible without login Plain text file LICENSE Lic. License information
Plain text file rightFragment.php Class Right fragment class
Plain text file subSequence.php Class Sub sequence class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:103
This week:0
All time:9,767
This week:488Up