PHPackages                             boxuk/describr - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. boxuk/describr

ActiveLibrary[File &amp; Storage](/categories/file-storage)

boxuk/describr
==============

So, tell me about your file... Given any file, PHP library describr will describe it

v1.3.1(12y ago)727.6k21MITPHPPHP &gt;=5.3.0

Since Feb 15Pushed 12y ago9 watchersCompare

[ Source](https://github.com/boxuk/describr)[ Packagist](https://packagist.org/packages/boxuk/describr)[ RSS](/packages/boxuk-describr/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (1)

Describr
========

[](#describr)

Describr is an object-oriented library for describing files. It uses a plugins to determine as much information as it can about a file.

Describr can be run from the command line via a supplied script, or it can be integrated into any PHP project to gather information about a variety of file types. You can write your own plugins, and a few of the file types Describr supports "out of the box" with the bundled plugins include:

- GIF
- JPEG
- PNG
- WMV
- MP4
- MP3
- AVI
- ... and many more!

If there's a file you want to interrogate and its type isn't supported, you can add a plugin to {describr root}/lib/BoxUK/Describr/Plugins and it will automatically be picked up and ready for use!

Requirements:
-------------

[](#requirements)

- PHP 5.3+
- Fileinfo extension

Plugins may have their own requirements. Some of the requirements for bundled plugins are:

- GD extension - needed by the image file analysis plugin
- [PHP-reader 1.8.1 or better](http://code.google.com/p/php-reader/ "PHP-Reader version 1.8.1 or better") - needed by the audio/video file analysis plugins
- [Zend Framework](http://framework.zend.com/) - needed by PHP-Reader

Installation
------------

[](#installation)

It's easy to get Describring! If you just want to use it without writing plugins, you can install through our PEAR channel, pear.boxuk.net (check our [Box UK Labs page](http://www.boxuk.com/labs/ "Box UK Labs - Web experiments and prototypes") for details on that), but we're assuming that because you're here on our Github you want to get stuck in and grab the source. Great! Here's how you do it:

1. Install Zend Framework version 1.(latest). Probably best installed via PEAR so it's automatically on your PHP path, else you'll need to add it to the path manually.
2. Download or checkout [PHP-reader 1.8.1 or better](http://code.google.com/p/php-reader/ "PHP-Reader version 1.8.1 or better")and add it to your PHP include path.
3. Grab the source from [Github](https://github.com/boxuk/describr) by cloning the repo (or downloading the zip).

### What if I can't add things to my php include path?

[](#what-if-i-cant-add-things-to-my-php-include-path)

If, in stages (1) and (2), you weren't able to add Zend and PHP-Reader to your PHP include path, you can do the following:

In the root of Describr, copy {describr root}/lib/bootstrap.custom.php-sample to {describr root}/lib/bootstrap.custom.php. You'll now need to edit {describr root}/lib/bootstrap.custom.php and provide a path to PHP-Reader. You might also need to set a path to Zend Framework in there too.

If you don't include the Zend Framework and PHP-Reader, Describr will still work but you will not be able to use it to get much information about audio/video files.

Using Describr
--------------

[](#using-describr)

It's time to test that Describr is installed and ready to rock! We've provided a simple command line executable script to help you do this, so if you're on Linux/OSX/Unix, chmod {describr root}/bin/describr to be executable. On Windows, you should just be able to run {describr root}/bin/describr.bat:

```
gavd@gavd-desktop:/opt/BoxUK/describr$ bin/describr
describr - tell me about your file...
(c) 2011 Box UK
Usage: describr [path to file]
       describr [path to file 1] [path to file 2] ... [path to file N]
```

If you don't see the above, head back to the Installation section and see if there's anything you've missed. Failing that, there's a Troubleshooting section below

and then you should be able to do something like:

```
gavd@gavd-desktop:/opt/BoxUK/describr$ bin/describr tmp.txt
Analysing tmp.txt...
array(2) {
  ["BoxUK\General"]=>
  array(6) {
    ["errors"]=>
    array(0) {
    }
    ["extension"]=>
    string(3) "txt"
    ["type"]=>
    string(8) "document"
    ["mimeType"]=>
    string(10) "text/plain"
    ["fileSizeInBytes"]=>
    int(4)
    ["fileSize"]=>
    string(11) "Extra Small"
  }
  ["BoxUK\PlainText"]=>
  array(4) {
    ["errors"]=>
    array(0) {
    }
    ["lines"]=>
    int(1)
    ["characters"]=>
    int(4)
    ["words"]=>
    int(1)
  }
}
```

So, we're up and running! Unless we're not, in which case:

### Troubleshooting

[](#troubleshooting)

Please check that:

1. Make sure you've chmodded {describr}/bin/describr to be executable if you're on Linux/Unix/OSX:

```
    gavd@gavd-desktop:/opt/BoxUK/describr$ chmod u+x bin/describr
```

2. Zend Framework and PHP-Reader are both on the PHP include path OR you are using a custom bootstrap.php. In the latter case, check that {describr root}lib/bootstrap.custom.php exists and $describr\_pathToPHPReaderLibrary is set correctly. It must point to the "library" or "src" directory (depending on the version of php-reader you're using) - the one that contains the directory "Zend"
3. Zend Framework should be installed. Installing this by PEAR is probably the cleanest way to do this, but if you are not able to use PEAR (e.g. you're on restrictive shared hosting, you can add the following to {describr root}/lib/bootstrap.custom.php:

```
