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
Phpunit Xml

Phpunit Xml Laravel Package

lastdragon-ru/phpunit-xml

Tools for working with PHPUnit’s XML configuration: parse, build, and validate phpunit.xml files programmatically. Useful for CI automation, config generation, and upgrades/migrations between PHPUnit versions, with a focused API designed for PHP projects.

View on GitHub
Deep Wiki
Context7

PHPUnit XML / XML Schema assertions.

Frequently asked questions about Phpunit Xml
How do I install lastdragon-ru/phpunit-xml in a Laravel project?
Run `composer require lastdragon-ru/phpunit-xml --dev` in your project root. The package is designed as a PHPUnit extension, so no additional Laravel service provider or config is needed—just require it in your test classes.
Does this package support Laravel’s testing helpers (e.g., $this->assertDatabaseHas) alongside XML assertions?
Yes, it integrates seamlessly with Laravel’s testing tools. Use it alongside `assertDatabaseHas` or `assertJson` in the same test class, as it’s a standalone PHPUnit extension with no Laravel-specific dependencies.
Can I validate XML schemas (XSD) with this package, or is it just for basic XML structure checks?
This package supports XML schema validation (XSD) out of the box, unlike PHPUnit’s native `assertXmlFileEqualsXmlFile`. It’s designed for rigorous schema compliance checks, making it ideal for SOAP APIs or config files with strict validation rules.
Will this work with Laravel’s Pest testing framework?
No, this package is built for PHPUnit only. Pest uses a different assertion system, so you’d need to either stick with PHPUnit or explore alternatives like `spatie/laravel-pest` for Pest-specific XML validation.
How do I handle large XML files (e.g., 50MB+) in tests without memory issues?
The package isn’t optimized for streaming or async validation of massive XML files. For large files, pre-process them with tools like `xmllint` or use PHP’s `XMLReader` in a separate step before assertions. Test with smaller subsets first.
Can I use this to validate XML responses from Guzzle HTTP clients in Laravel?
Absolutely. After making a Guzzle request, extract the XML response (e.g., `$response->getBody()->getContents()`) and pass it to the package’s assertions like `assertXmlStringMatchesSchema()`. Works great for SOAP or XML-based APIs.
Does this package support Laravel’s service container for runtime XML validation outside tests?
No, it’s strictly for PHPUnit tests. For runtime validation, bind a custom service (e.g., `XMLValidator`) using Laravel’s container and leverage libraries like `SimpleXML` or `DOMDocument` instead.
How do I migrate from PHPUnit’s native XML assertions to this package?
Replace `assertXmlFileEqualsXmlFile()` with `assertXmlFileMatchesSchema()` or `assertXmlStringMatchesSchema()` for schema validation. The package offers a more fluent API, so refactor tests incrementally—start with critical XML checks first.
Is there a way to generate or modify phpunit.xml dynamically using this package?
Yes, the package includes tools to parse, build, and validate `phpunit.xml` files programmatically. Use `XmlConfigBuilder` to construct configs dynamically, which is useful for CI/CD pipelines or multi-environment setups.
What Laravel versions and PHPUnit versions does this package support?
The package requires PHPUnit ≥8.0 (compatible with Laravel 8+). It has no Laravel-specific dependencies, so it works as long as your project uses PHPUnit. Check the package’s `composer.json` for exact PHPUnit version constraints.
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