PHP code example of dflydev / canal

1. Go to this page and download the library: Download dflydev/canal library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dflydev / canal example snippets




// 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