Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sweetdom Laravel Package

s9e/sweetdom

SweetDOM is a lightweight PHP library for fast DOM parsing and manipulation. It offers a simple, jQuery-like API to find, traverse, and edit HTML/XML documents, making common scraping and transformation tasks easier without heavy dependencies.

View on GitHub
Deep Wiki
Context7
3.4.0

Added isEqualNode() polyfill to all extended classes:

  • s9e\SweetDOM\Attr
  • s9e\SweetDOM\Cdatasection
  • s9e\SweetDOM\Comment
  • s9e\SweetDOM\Document
  • s9e\SweetDOM\DocumentFragment
  • s9e\SweetDOM\Element
  • s9e\SweetDOM\Text
3.3.0

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\SweetDOM namespace, 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::after
  • ChildNode::before
  • ChildNode::replaceWith
  • ParentNode::append
  • ParentNode::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::after
  • ChildNode::before
  • ChildNode::replaceWith
2.1.0.1

This is 2.1.0 + 4e08ac81b392798b7e7c0f56a62d743045386938 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.
3.2.0

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: https://github.com/s9e/SweetDOM/compare/3.1.0...3.2.0

3.1.0

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.0

Full Changelog: https://github.com/s9e/SweetDOM/compare/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, and replaceWith.
  • Support for magic methods and XPath methods has been extended to more classes. See README.md for a list of classes.
  • s9e\SweetDOM\Document has a new $nodeCreator property that can be used to extend the range of nodes that can be created by magic methods.
2.1.2

Full Changelog: https://github.com/s9e/SweetDOM/compare/2.1.1...2.1.2

s9e\SweetDOM\Element::insertAdjacentElement()'s signature has been made compatible with PHP 8.3.

2.0.0

The following methods have been removed from s9e\SweetDOM\Element:

  • remove()
  • replace()

They have been replaced with a polyfill for the following methods introduced in PHP 8.0.

void remove()
void replaceWith(...$nodes)
2.0.0-alpha.1

Element::remove()'s signature has been modified to match PHP 8.0's new remove() method.

1.0.1

Fixed annotations.

1.0.0

Initial release

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor