PHP code example of chuoke / uri-meta

1. Go to this page and download the library: Download chuoke/uri-meta 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/ */

    

chuoke / uri-meta example snippets


    $extracter = new UriMetaExtracter();

    $uriMeta = $extracter->extract('https://www.php.net/');

    echo $uriMeta->title(); // PHP: Hypertext Preprocessor

    print_r($uriMeta->toArray());
    // Array
    // (
    //     [uri] => https://www.php.net/
    //     [host] => www.php.net
    //     [scheme] => https
    //     [title] => PHP: Hypertext Preprocessor
    //     [description] => https://www.php.net/
    //     [keywords] =>
    //     [icons] => Array
    //         (
    //             [0] => https://www.php.net/favicon.ico
    //         )

    // )

    $uriMeta = $extracter->extract('https://github.com/php/php-src');

    print_r($uriMeta->toArray());
    // Array
    // (
    //     [uri] => https://github.com/php/php-src
    //     [host] => github.com
    //     [scheme] => https
    //     [title] => GitHub - php/php-src: The PHP Interpreter
    //     [description] => The PHP Interpreter. Contribute to php/php-src development by creating an account on GitHub.
    //     [keywords] =>
    //     [icons] => Array
    //         (
    //             [0] => https://github.githubassets.com/favicons/favicon.svg
    //             [1] => https://github.githubassets.com/pinned-octocat.svg
    //             [2] => https://github.com/favicon.ico
    //         )
    // )