PHPackages                             einfacharchiv/microdata - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. einfacharchiv/microdata

ActiveLibrary

einfacharchiv/microdata
=======================

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

v3.0.0(1y ago)0328↓100%MITPHPPHP ^7.0 || ^8.0

Since Feb 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/einfachArchiv/microdata)[ Packagist](https://packagist.org/packages/einfacharchiv/microdata)[ Docs](https://github.com/einfachArchiv/microdata)[ RSS](/packages/einfacharchiv-microdata/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (3)Versions (7)Used By (0)

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

[](#extract-billing-data-from-html-supporting-microdata-and-json-ld)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

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

Requirements
------------

[](#requirements)

PHP 7.0 and later.

Installation
------------

[](#installation)

You can install this package via [Composer](http://getcomposer.org). Run the following command:

```
composer require einfacharchiv/microdata
```

Usage
-----

[](#usage)

Extracting billing data from HTML is easy.

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

```
$html = '...';

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

[](#contributing)

Contributions are **welcome**.

We accept contributions via Pull Requests on [Github](https://github.com/einfachArchiv/microdata).

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](https://github.com/einfachArchiv/microdata/issues), we'll try to address it as soon as possible.

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

**Happy coding**!

Credits
-------

[](#credits)

- [Philip Günther](https://github.com/Pag-Man)
- [All Contributors](https://github.com/einfachArchiv/microdata/contributors)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~389 days

Recently: every ~486 days

Total

6

Last Release

638d ago

Major Versions

v1.1 → v2.02019-03-01

v2.0.2 → v3.0.02024-06-22

PHP version history (2 changes)v1.0PHP ~7.0

v3.0.0PHP ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7369d061aa626fd1c448315ca5e53d01daf448c6e5f37be95a46946cda406e8e?d=identicon)[Pag-Man](/maintainers/Pag-Man)

---

Top Contributors

[![philipgunther](https://avatars.githubusercontent.com/u/15112900?v=4)](https://github.com/philipgunther "philipgunther (2 commits)")

---

Tags

data-extractionhtmljson-ldmicrodataphpphphtmlJSON-LDdata extractionmicrodataeinfachArchiv

### Embed Badge

![Health badge](/badges/einfacharchiv-microdata/health.svg)

```
[![Health](https://phpackages.com/badges/einfacharchiv-microdata/health.svg)](https://phpackages.com/packages/einfacharchiv-microdata)
```

###  Alternatives

[daandesmedt/phpheadlesschrome

A PHP wrapper for using Google Chrome Headless mode. Convert URL or HTML to a PDF / screenshot. Easy to use and OOP interfaced.

92225.4k](/packages/daandesmedt-phpheadlesschrome)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
