Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: veewee/xml

Version 4.3.0

24 Oct 12:54
4.3.0
0a3d5ae

Choose a tag to compare

What's Changed

Full Changelog: 4.2.0...4.3.0

Version 3.4.0

15 Oct 08:13
3.4.0
8799d7b

Choose a tag to compare

What's Changed

  • Update symfony/finder requirement from ^6.1 to ^6.1 || ^7.0 by @dependabot[bot] in #84
  • Upgrade to PHP 8.5 and latest dependencies by @veewee in #90

New Contributors

Full Changelog: 3.3.0...3.4.0

Version 4.2.0

26 Jan 15:11
4.2.0
a732fcd

Choose a tag to compare

What's Changed

  • Inherit XMLNS during encoding like we did in v3 by @veewee in #88

Full Changelog: 4.1.0...4.2.0

Version 4.1.0

08 Dec 11:24
4.1.0
86a8497

Choose a tag to compare

What's Changed

  • Allow empty docs inside configurators like pretty_print by @veewee in #86

Full Changelog: 4.0.0...4.1.0

Version 4.0.0

20 Nov 17:29
4.0.0
9a1e9c9

Choose a tag to compare

What's Changed

  • PHP84 : Add spec compliance by @veewee in #74
  • Introduce breaking reader/writer PHP 8.4 changes and new stream functions by @veewee in #79
  • Introduce XPath and XSLT callback functions by @veewee in #81

Spec compliance

Starting from v4, this package opt's-in to the spec compliance mode that has been released in PHP 8.4.
Since these changes cannot be ported to older PHP versions, v3 of this package will be maintained actively for a longer period.
This will give you a grace period to upgrade your PHP versions, packages, ...
This little bump in the road is necessary to provide you with a better, more stable and spec-compliant package in the future.

Support table:

veewee/xml PHP LTS
3.0 - 3.1 8.1, 8.2, 8.3 NO
3.2 8.2, 8.3 NO
3.3+ 8.2, 8.3, 8.4 YES
4.0+ 8.4+ YES

Full Changelog: 3.2.0...4.0.0

Version 4.0.0-alpha1

25 Oct 09:58
4.0.0-alpha1
5a4c3f9

Choose a tag to compare

Version 4.0.0-alpha1 Pre-release
Pre-release

What's Changed

  • PHP84 : Add spec compliance by @veewee in #74
  • Introduce breaking reader/writer PHP 8.4 changes and new stream functions by @veewee in #79
  • Introduce XPath and XSLT callback functions by @veewee in #81

Full Changelog: 3.2.0...4.0.0-alpha1

Version 3.3.0

25 Oct 06:13
3.3.0
6ae6b15

Choose a tag to compare

What's Changed

  • Add support for PHP 8.4 for XML v3 by @veewee in #82

Full Changelog: 3.2.0...3.3.0

Version 3.2.0

06 Sep 09:55
3.2.0
a825290

Choose a tag to compare

What's Changed

ℹ️

Bump to PSL 3, implies bumping PHP to >8.2
People on 8.1 can still use older versions of this package. (it's all pretty stable right now)

Full Changelog: 3.1.0...3.2.0

Version 3.1.0

29 Jan 18:18
3.1.0
7cb255b

Choose a tag to compare

What's Changed

  • Fix psalm 5.20 by @veewee in #69
  • Attempt to create file and directory when starting a writer for a file by @veewee in #71

Full Changelog: 3.0.0...3.1.0

Version 3.0.0

14 Jan 13:07
3.0.0
90affd5

Choose a tag to compare

What's Changed

  • Add reader MatchingNode results and a signal to stop reading by @veewee in #66
  • Drop deprecations by @veewee in #68

Breaking changes

This new version introduces 1 breaking change in the Reader component:

Reader

Instead of providing the results as a string, this string are now wrapped with a MatchingNode.
This allows us to also provide information like the matched NodeSequence and some shortcut functions for converting this XML into a DOM Document or decoded version of the XML.

If you are using the Reader of v2, you will have to change your implementation to support the MatchingNode instead of the string result from previous version.

An example:

use VeeWee\Xml\Dom\Configurator;
use VeeWee\Xml\Reader\Signal;
use function VeeWee\Xml\Reader\Matcher\element_name;
use function VeeWee\Xml\Reader\Matcher\sequence;


$xml = <<<XML
    <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
      <services>
        <service id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true"/>
        <service id="kernel" class="TicketSwap\Kernel" public="true" synthetic="true" autoconfigure="true">
          <tag xmlns="http://symfony.com/schema/dic/tag-1" name="controller.service_arguments">1</tag>
          <tag xmlns="http://symfony.com/schema/dic/tag-2"  name="routing.route_loader">2</tag>
        </service>
      </services>
    </container>
XML;


$reader = VeeWee\Xml\Reader\Reader::fromXmlString($xml);
$signal = new Signal();

foreach ($reader->provide(element_name('tag'), $signal) as $tag) {
    // New result of the reader is now a DTO that contains both the XML and node sequence.
    var_dump(
       // This is the previous matched XML `string`
        $tag->xml(),
        // Contains a match function so that you can run a secondary matcher on the result.
        // Can be handy if you are matching on multiple paths in one read for example.
        $tag->matches(sequence(
                element_name('container'),
                element_name('services'),
                element_name('service'),
                element_name('tag')
        )),
        // You can now directly pull the xml into a DOM Document with or without a DOM configurator.
        $tag->intoDocument(Configurator\canonicalize()),
        // Or decode it directly using xml_decode:
        $tag->decode(Configurator\canonicalize()),
        // You can get access to the current matching NodeSequence data:
        $tag->nodeSequence(),
    );

    // Stops reading on first `tag` match.
    $signal->stop();
}

Removed deprecations:

Following functions were deprecated in v2 and are removed from v3:

  • Reader\Matcher\node_name: Use Reader\Matcher\element_name instead.
  • Reader\Matcher\node_attribute: Use Reader\Matcher\attribute_value instead.

Full Changelog: 2.14.0...3.0.0