- How do I install alies-dev/psalm-tester in a Laravel project?
- Run `composer require alies-dev/psalm-tester` in your project root. Ensure Psalm (v5+) is installed separately via `composer require vimeo/psalm`. The package provides a CLI command (`psalm-tester`) that integrates with Laravel’s existing testing workflow.
- Does this package work with Laravel’s Pest or PHPUnit?
- Yes, it’s designed to work alongside Pest or PHPUnit. You can run Psalm tests via the `psalm-tester` command in your test suite or CI pipeline, just like any other test command. It outputs results in a format compatible with both frameworks.
- What Laravel versions does alies-dev/psalm-tester support?
- The package is framework-agnostic but optimized for Laravel 9+. It leverages PHP 8.1+ features and works with any Laravel version that supports Psalm (v5+). Check the package’s `composer.json` for PHP version requirements.
- Can I use this to enforce Psalm rules in CI without blocking merges?
- Yes, configure the package to output structured results (JSON/CLI) and use CI conditions to fail builds only on critical issues. For example, GitHub Actions can parse Psalm errors and add them as annotations without blocking PRs.
- How do I configure Psalm for project-specific rules in Laravel?
- Create a `psalm.xml` file in your project root to define custom rules (e.g., stricter checks for `app/` or `app/Http`). The package respects project-local configurations, so you can exclude vendor directories or focus analysis on specific paths.
- Will this slow down my CI pipeline? How can I optimize it?
- Psalm can be slow for large codebases, but you can mitigate this by using Psalm’s `--init` flag for incremental analysis or caching results in CI (e.g., GitHub Actions cache). Parallelize runs if your CI supports it.
- What if Psalm gives false positives in my Laravel app?
- Start with `--no-cache` to refine rules incrementally, then compare results against your baseline. Use the package’s test assertions to validate expected behavior—treat it like unit tests for static analysis.
- Is there a way to integrate Psalm test results with Laravel’s error tracking (e.g., Sentry)?
- Yes, the package outputs structured results (JSON/CLI) that can be parsed and forwarded to Sentry or other monitoring tools. Use CI scripts to transform Psalm errors into Sentry events or Slack alerts.
- What’s the difference between this and running Psalm directly via CLI?
- This package automates Psalm testing in a Laravel-friendly way—it validates expected issues or clean runs via test assertions, integrates with Pest/PHPUnit, and handles CI output formatting. Running Psalm directly lacks these test-driven workflows.
- How do I handle Psalm version updates without breaking my Laravel project?
- Pin Psalm’s version in `composer.json` to avoid surprises. Use the package’s test suite to validate Psalm behavior after updates, and gradually adjust `psalm.xml` rules if breaking changes occur.