chuoke/uri-meta

获取 URI META

0.0.4 2021-09-28 02:11 UTC

This package is auto-updated.

Last update: 2024-09-04 21:30:27 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

此包可用于提取 URI 的元信息。

安装

您可以通过 composer 安装此包

composer require chuoke/uri-meta

用法

    $extracter = new UriMetaExtracter();

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

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

    print_r($uriMeta->toArray());
    // Array
    // (
    //     [uri] => https://php.ac.cn/
    //     [host] => www.php.net
    //     [scheme] => https
    //     [title] => PHP: Hypertext Preprocessor
    //     [description] => https://php.ac.cn/
    //     [keywords] =>
    //     [icons] => Array
    //         (
    //             [0] => https://php.ac.cn/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
    //         )
    // )

许可协议

MIT 许可协议(MIT)。请参阅 许可文件 获取更多信息。