- How do I install symplify/changelog-linker for a Laravel project?
- Run `composer require --dev symplify/changelog-linker` in your Laravel project. The package includes a CLI tool (`vendor/bin/changelog-linker`) and a PHP library. No Laravel-specific setup is required beyond PHP 8.0+ compatibility.
- Will this work with Laravel’s default CHANGELOG.md format?
- Yes, the package follows Keep a Changelog conventions by default. It automatically links version headers (e.g., `## 1.2.0`) to Git tags and categorizes entries (Added/Changed/Fixed/Removed). Custom formats may need configuration via `--config` flags or a custom regex pattern.
- Can I integrate this into Laravel’s release workflow?
- Absolutely. Add a Composer script like `'post-release': 'changelog-linker link CHANGELOG.md'` to `composer.json`, or trigger it in CI/CD (e.g., GitHub Actions) after tagging. For tighter Laravel integration, wrap it in a custom Artisan command.
- Does symplify/changelog-linker support GitLab or Bitbucket?
- Yes, it works with any Git-hosted platform (GitHub, GitLab, Bitbucket, etc.). Configure the `--repository-url` flag to point to your repo (e.g., `git@gitlab.com:user/project.git`). The package detects the host and generates correct URLs automatically.
- What happens if my CHANGELOG.md has non-standard formatting?
- The tool uses regex patterns to parse versions and references. If your changelog deviates (e.g., nested headers like `### Breaking Changes`), you can override defaults with `--config` or a custom regex. Test edge cases locally before CI integration.
- Is this safe to run in a CI pipeline like GitHub Actions?
- Yes, it’s designed for CI. Add it as a step in your release workflow (e.g., after `git tag`). Ensure Git is available in your CI environment. For GitHub Actions, use `actions/checkout@v4` to fetch the repo before running the linker.
- Can I use this for Laravel packages published on Packagist?
- Absolutely. Many Laravel packages use this to auto-link their changelogs for Packagist and GitHub. It’s especially useful for open-source projects where contributors may not manually format links. Just ensure your `composer.json` includes the dev dependency.
- How do I handle manual edits to the changelog after linking?
- Run the linker again to re-process the file. If contributors manually edit links (e.g., breaking Markdown syntax), use a pre-commit hook to validate the changelog structure. The tool overwrites the file by default, so conflicts are resolved by re-running it.
- Are there alternatives for Laravel-specific changelog tools?
- Most alternatives are Laravel-agnostic (e.g., `php-changelog-generator` or custom scripts). This package stands out for its Git-aware linking, CLI flexibility, and zero Laravel dependencies. For Laravel-only needs, consider wrapping it in an Artisan command for tighter integration.
- How do I test symplify/changelog-linker before production use?
- Test locally with `vendor/bin/changelog-linker link CHANGELOG.md` and verify links in the output. Write unit tests for edge cases (e.g., malformed references) using the PHP library. Mock Git commands in tests if needed. The package includes basic tests, but custom changelog formats may require additional validation.