dflydev/canal

Content analysis for the purpose of determining Internet media types.

Installs: 118 332

Dependents: 1

Suggesters: 0

Security: 0

Stars: 33

Watchers: 4

Forks: 6

Open Issues: 1

pkg:composer/dflydev/canal

v1.0.0 2013-05-14 05:22 UTC

This package is auto-updated.

Last update: 2025-09-29 01:20:56 UTC


README

Content analysis for the purpose of determining Internet media types.

Requirements

  • PHP 5.3+

Installation

Through Composer as dflydev/canal.

Usage

<?php

// Instantiate the Analyzer
$analyzer = new Dflydev\Canal\Analyzer\Analyzer;

// Detect a media type from a filename (file does not need to exist)
$internetMediaType = $analyzer->detectFromFilename('/path/to/whatever.png');

// See the media type as a string
print $internetMediaType->asString()."\n\n";

// See the media type's type
print $internetMediaType->getType()."\n\n";

// See the media type's subtype
print $internetMediaType->getSubtype()."\n\n";

// image/png
//
// image
//
// png

License

MIT, see LICENSE.

Not Invented Here

This work was heavily influenced by Apache Tika and Ferret.