承接 einfacharchiv/microdata 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

einfacharchiv/microdata

Composer 安装命令:

composer require einfacharchiv/microdata

包简介

Extract billing data from HTML (supporting Microdata and JSON-LD)

README 文档

README

Software License

This package provides an easy way to extract billing data from Microdata and JSON-LD in an HTML document.

Requirements

PHP 7.0 and later.

Installation

You can install this package via Composer. Run the following command:

composer require einfacharchiv/microdata

Usage

Extracting billing data from HTML is easy.

If an item is not present, the method returns null.

$html = '<!doctype html><html lang="en"><head>...';

$microdata = new Microdata($html);

// Get all invoice items
foreach ($microdata->getItemsByType('Invoice') as $item) {
    // Available methods
    (string) $item->getBillingPeriod() ?: null;
    $item->getConfirmationNumber();

    if ($item->getCustomer()) {
        (string) $item->getCustomer()->getIdentifier() ?: null;
        $item->getCustomer()->getName();

        if ($item->getCustomer()->getAddress()) {
            $item->getCustomer()->getAddress()->getStreetAddress();
            $item->getCustomer()->getAddress()->getPostOfficeBoxNumber();
            $item->getCustomer()->getAddress()->getPostalCode();
            $item->getCustomer()->getAddress()->getAddressLocality();
            $item->getCustomer()->getAddress()->getAddressRegion();
            (string) $item->getCustomer()->getAddress()->getAddressCountry() ?: null;
        }

        $item->getCustomer()->getEmail();
        $item->getCustomer()->getTelephone();
        $item->getCustomer()->getUrl();

        $item->getCustomer()->getTaxId();
        $item->getCustomer()->getVatId();
    }

    (string) $item->getPaymentDueDate() ?: null;
    (string) $item->getPaymentMethod() ?: null;
    $item->getPaymentMethodId();
    (string) $item->getPaymentStatus() ?: null;

    if ($item->getProvider()) {
        $item->getProvider()->getName();

        if ($item->getProvider()->getAddress()) {
            $item->getProvider()->getAddress()->getStreetAddress();
            $item->getProvider()->getAddress()->getPostOfficeBoxNumber();
            $item->getProvider()->getAddress()->getPostalCode();
            $item->getProvider()->getAddress()->getAddressLocality();
            $item->getProvider()->getAddress()->getAddressRegion();
            (string) $item->getProvider()->getAddress()->getAddressCountry() ?: null;
        }

        $item->getProvider()->getEmail();
        $item->getProvider()->getTelephone();
        $item->getProvider()->getUrl();

        $item->getProvider()->getTaxId();
        $item->getProvider()->getVatId();
    }

    if ($item->getTotalPaymentDue()) {
        $item->getTotalPaymentDue()->getAmount(); // Returns an array with 'amount' and 'currency'
    }

    (string) $item->getIdentifier() ?: null;
    $item->getName();
    $item->getUrl();
}

Contributing

Contributions are welcome.

We accept contributions via Pull Requests on Github.

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improvement? Feel free to create an issue on GitHub, we'll try to address it as soon as possible.

If you've found a security issue, please email support@einfacharchiv.com instead of using the issue tracker.

Happy coding!

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 332
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固