- How do I integrate this package into a Laravel project for automated changelog generation?
- Install via Composer (`composer require --dev marcocesarato/php-conventional-changelog`), then run the CLI command directly or wrap it in a custom Artisan command. For example, create `app/Console/Commands/GenerateChangelog.php` to trigger it via `php artisan changelog`. Configure release ranges and templates in `.changelogrc` or a Laravel config file.
- Does this package support Laravel’s existing Conventional Commits (e.g., `feat:`, `fix:`) and SemVer?
- Yes, it fully supports Conventional Commits and SemVer. Laravel projects already using these standards will integrate seamlessly. The package parses commit messages and automatically bumps versions based on commit types (e.g., `BREAKING CHANGE:` triggers a major version bump).
- Can I customize the changelog output format for Laravel-specific needs (e.g., database migrations)?
- Absolutely. Use the `.changelogrc` config file to define custom commit types (e.g., `laravel:`) or modify templates to include Laravel-specific sections like database migrations. The package’s flexible configuration system allows full control over Markdown output structure.
- Will this work with Laravel’s Git-based release workflows (e.g., `git tag`, `git push`)?
- Yes, the package is Git-centric and integrates perfectly with Laravel’s release workflows. You can generate changelogs on tag pushes or in CI/CD pipelines (e.g., GitHub Actions) by running the CLI command or a custom Artisan command. It respects Laravel’s tagging conventions if configured properly.
- How do I handle conflicts with Laravel’s existing Git hooks (e.g., pre-commit tests)?
- The package doesn’t interfere with Git hooks by default. If you use `--no-verify` in CI, document this in your team’s runbook to avoid bypassing critical hooks. For Laravel, ensure hooks like `pre-commit` (e.g., for testing) remain active by excluding the changelog command from `--no-verify` or running it separately.
- Does this package work with Laravel 8/9/10 and PHP 8.0+?
- The package supports PHP ≥7.1.3, so it works with Laravel 8+ (PHP 8.0+). While there’s no risk of breaking functionality, custom configs using PHP 8+ features (e.g., typed properties) may trigger deprecation warnings. Test thoroughly with Laravel’s PHP version matrix to ensure compatibility.
- Can I generate changelogs in CI/CD (e.g., GitHub Actions) for Laravel releases?
- Yes, it’s ideal for CI/CD. Add the command to your workflow (e.g., `vendor/bin/conventional-changelog --release`) and gate it to specific branches (e.g., `main`). Handle failures gracefully by checking for commits since the last tag or skipping if no changes exist. Example: `if git rev-list --tags --max-count=1..HEAD >/dev/null; then ...; fi`
- How do I configure the package to match Laravel’s release scripts (e.g., `laravel-shift/release`)?
- Use the package to complement Laravel’s release scripts rather than replace them. Configure it to generate changelogs post-tagging (e.g., after `git tag v1.0.0`) and integrate it into your existing workflow. For example, run it after `composer version` or `git push --tags` in your release script.
- Where should I store the `.changelogrc` config file for a Laravel project?
- Store it in the project root (e.g., `.changelogrc`) or leverage Laravel’s config system by publishing the config file (e.g., `php artisan vendor:publish --tag=changelog-config`) to `config/changelog.php`. This keeps configs version-controlled and environment-specific if needed (e.g., dev vs. prod templates).
- Are there alternatives to this package for Laravel changelogs?
- Alternatives include `php-changelog-generator` or custom scripts using Git commands, but this package is tailored for Conventional Commits and SemVer with Laravel in mind. It offers built-in CLI integration, configurable templates, and seamless Artisan command wrapping—features that simplify adoption for Laravel teams.