php-mf2 is a pure, generic microformats-2 parser for PHP. It makes HTML as easy to consume as JSON.
Breaking changes:
alt
attribute will now be a {'value': 'url', 'alt': 'the alt value'}
structure rather than a single URL stringmaster
branch to main
. Anyone who had been installing the latest development version with dev-master
will need to change their requirements to dev-main
Other changes:
Bugfixes:
Other Updates:
Bugfixe:
e-
elementsOther Updates:
.editorconfig
to the project and cleaned up whitespace across all filesBugfixes:
properties
is an object {}
rather than array []
(#171)Microformats Parsing Updates:
u-
properties even when not from a link element (Parsing issue #10)Other Updates:
This release includes support for using an alternative HTML parser that understands HTML5 tags.
The built-in HTML parser does not understand some HTML5 tags such as <article>
, which causes issues when those tags are adjacent to elements that can be automatically closed, such as <p>
. A simple example that is incorrectly parsed with a non-HTML5 parser is below.
<div class="h-entry">
<p class="p-name">Hello World
<article class="e-content">The content of the blog post</article>
</div>
Without proper knowledge of HTML5 tags such as <article>
, the contents of that tag ends up inside the p-name
in this example. Using an HTML5 parser will properly close the <p>
tag and return the expected result.
The php-mf2
library does not automatically install the HTML5 parser, since it does not want to impose additional dependencies on your code base. If you wish to use the HTML5 parser, you can include it in your project explicitly, either by loading it manually or using composer:
composer require masterminds/html5
If this library is present, then the php-mf2
parser will use it when parsing HTML.
Fixes:
Backcompat:
rel=tag
as p-category
for hEntry and hReviewrel-urls
to parsed result. Removes alternates
by default but still available behind a feature flag.p-name
. See Microformats issue #6. This means it is now possible for the parsed result to not have a name
property, whereas before there was always a name
property on an object. Make sure consuming code can handle an object without a name now.h-*
class names containing invalid characters.dt-
parsing. Issues #126 and #115.rel=bookmark
backcompat parsing.summary
property in hreview
Thanks to @gRegorLove and @jkphl for all their hard work in this release!
This release includes the following fixes:
img alt=""
attributesAccept: text/html
header when using the fetch
methodposter
attribute for video
tagsThis release contained an error in the composer.json
file causing installations via composer to fail. Release notes have been moved to v0.3.2