s9e/sweetdom
Syntactic sugar for the DOM API with a focus on XSLT 1.0 template manipulation.
3.4.1
2.4M downloads/mo
#2756 most downloaded on Packagist
s9e/SweetDOM
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Ships unpredictably
gaps range from 9 days to 2.0 years
Most releases are documented
notes for 9 of 14 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
15 releases · first in 2020
0 releases in the last 12 months
see the full history below
Release timeline
15 releases · May 2020 to Mar 2024Releases
latest 15-
3.4.123 Mar 2024 -
3.4.001 Jan 2024Release notes
Open source →Added
isEqualNode()polyfill to all extended classes:s9e\SweetDOM\Attrs9e\SweetDOM\Cdatasections9e\SweetDOM\Comments9e\SweetDOM\Documents9e\SweetDOM\DocumentFragments9e\SweetDOM\Elements9e\SweetDOM\Text
-
3.3.021 Dec 2023Release notes
Open source →In order to improve compatibility with older versions of PHP as well as future versions of PHP, this release uses a different set of classes to implement node types depending on the PHP version. The base classes are those created directly in the
s9e\SweetDOMnamespace, and only those classes should be used when checking for class types.Backward compatibility with older versions of PHP
On PHP older than 8.1.23, and on PHP versions from 8.2.0 to 8.2.9, the following methods are emulated:
ChildNode::afterChildNode::beforeChildNode::replaceWithParentNode::appendParentNode::prepend
Forward compatibility with future versions of PHP
The following methods have been modified to match PHP 8.3's behaviour with regards to disconnected nodes (nodes with no parent) and align with the DOM specification.
ChildNode::afterChildNode::beforeChildNode::replaceWith
-
3.2.026 Nov 2023Release notes
Open source →This version adds a polyfill for
Element::replaceChildren()which is available in PHP 8.3.0. There is currently no plans to add a similar polyfill to other implementors.Full Changelog: 3.1.0...3.2.0
-
3.1.015 Nov 2023Release notes
Open source →This version adds support for batch operations via document fragments. For example:
$dom = new s9e\SweetDOM\Document; $dom->loadXML('<x/>'); $x = $dom->firstOf('//x'); $x->appendDocumentFragment( // The callback will be executed before the fragment is appended fn($fragment) => $fragment->appendXML('<y/><z/>') ); echo $dom->saveXML($x);
<x><y/><z/></x>
-
3.0.116 Oct 2023 -
3.0.013 Oct 2023Release notes
Open source →Full Changelog: 2.1.2...3.0.0
This is a major update with a number of deprecations. See UPGRADING.md for a conversion guide.
New features:
- Magic methods now support the following DOM operations:
after,append,before,prepend, andreplaceWith. - Support for magic methods and XPath methods has been extended to more classes. See README.md for a list of classes.
s9e\SweetDOM\Documenthas a new$nodeCreatorproperty that can be used to extend the range of nodes that can be created by magic methods.
- Magic methods now support the following DOM operations:
-
2.1.207 Oct 2023Nothing published for this version
-
2.1.105 Jun 2023 -
2.1.024 May 2021Nothing published for this version
-
2.0.008 Dec 2020Nothing published for this version
-
2.0.0-alpha.108 Dec 2020 pre-releaseNothing published for this version
-
1.0.125 May 2020Nothing published for this version
-
1.0.024 May 2020Nothing published for this version
-
2.1.0.127 Nov 2023Release notes
Open source →This is 2.1.0 + 4e08ac8 and it is expected to work on PHP 7.1.
PHPUnit 7.5.20 by Sebastian Bergmann and contributors. Runtime: PHP 7.1.33 Configuration: /SweetDOM/phpunit.xml ..............................................S.S................ 65 / 70 ( 92%) ..... 70 / 70 (100%) Time: 40 ms, Memory: 4.00 MB There were 2 skipped tests: 1) s9e\SweetDOM\Tests\ElementTest::testRemoveException PHP >= 8.0 is required. 2) s9e\SweetDOM\Tests\ElementTest::testReplaceWithException PHP >= 8.0 is required. OK, but incomplete, skipped, or risky tests! Tests: 70, Assertions: 70, Skipped: 2.