- How do I install this package in a Laravel project?
- Run `composer require --dev pluswerk/grumphp-xliff-task` in your project root. Ensure GrumPHP is installed (v0.12+, v1.3+, or v2.x) and add the task to your `grumphp.yml` under the `tasks` section with `xlifflint` as the key. The package requires PHP 7.2+.
- What Laravel versions does this package support?
- This package works with any Laravel version (8.0+ recommended) as long as PHP 7.2+ is used. It’s framework-agnostic but integrates with Laravel’s localization tools like Spatie Translation Manager or Crowdin exports. No Laravel-specific dependencies exist.
- Can I use this without GrumPHP? What are the alternatives?
- No, this package requires GrumPHP. Alternatives include writing a custom PHP script using `xlifflint` CLI tool or integrating it into Laravel’s `php artisan` commands. However, GrumPHP provides a more robust pre-commit workflow for XLIFF validation.
- How do I configure ignore patterns for specific XLIFF files?
- Add `ignore_patterns` under the `xlifflint` task in `grumphp.yml` and specify glob patterns (e.g., `['**/tests/*.xlf']`). This skips linting for files matching the pattern. Example: `ignore_patterns: ['vendor/**', 'temp/*.xliff']`.
- Does this task support DTD or schema validation for XLIFF files?
- Yes, enable `dtd_validation: true` or `scheme_validation: true` in your `grumphp.yml` configuration. These flags require the `xlifflint` tool to support the respective validation type. Test thoroughly to avoid false positives in your CI pipeline.
- Will this task slow down my CI pipeline if XLIFF files are large?
- Performance depends on file size and CI environment. For large files (e.g., 100MB+), consider running the task in CI only (not locally) or splitting validation by language. Cache `xlifflint` results if your CI supports it, or use parallel jobs for faster execution.
- How do I handle false positives in XLIFF validation?
- False positives can be mitigated by adjusting `ignore_patterns` or tweaking validation flags (e.g., disable `dtd_validation`). For edge cases, manually override errors in `grumphp.yml` using `failure_level: warn` or suppress specific issues via `xlifflint` CLI options.
- What happens if `xlifflint` is not installed in my CI environment?
- The task will fail if `xlifflint` is missing. Install it in CI via package managers (e.g., `sudo apt-get install xlifflint` for Debian/Ubuntu) or use a Docker image with the tool pre-installed. Document this dependency in your CI setup to avoid runtime errors.
- Is this package actively maintained? Should I fork it for long-term use?
- The package appears dormant (last release in 2026) with no dependents. If maintenance is critical, consider forking it or using alternatives like a custom script with `xlifflint`. Check the GitHub repo for open issues or community activity before committing.
- Can I run this task only in CI and not locally for faster feedback?
- Yes, configure `triggered_by` in `grumphp.yml` to exclude local runs (e.g., `triggered_by: []` for local, then enable in CI). Alternatively, use GrumPHP’s `on_fail` or `async` settings to decouple validation from commit hooks.