- What is mll-lab/php-utils used for in Laravel projects?
- It provides reusable PHP helper classes and functions for arrays, strings, mixed values, and null-safe access. In Laravel repositories it can also bring PHPStan-related configuration and coding-standard rules for CI. It is framework-agnostic, so it works in Laravel, Symfony, or plain PHP. If you only need general helpers, Laravel's built-in support utilities or Symfony components may cover some use cases.
- How do I install mll-lab/php-utils with Composer?
- Install it with composer require mll-lab/php-utils, or use the --dev flag when you only need its static-analysis configuration in CI. For Laravel projects using PHPStan, add it as a dev dependency and run your normal Composer update. Check your PHPStan and Larastan versions first because v7 requires spaze/phpstan-disallowed-calls ^4.4.
- Does mll-lab/php-utils support Laravel 8, 9, 10, and 11?
- The utilities are framework-agnostic, so Laravel version support depends mostly on your PHP and static-analysis stack. The main compatibility issue in the provided context is PHP 8.0 with larastan 1.0.4 and older PHPStan, which conflicts with v7's spaze ^4.4 requirement. On PHP 8.1+ with modern Larastan and PHPStan, adoption is more straightforward. Always verify the combination in your CI pipeline before upgrading.
- What PHP version do I need for mll-lab/php-utils v7?
- v7 requires spaze/phpstan-disallowed-calls ^4.4, which in turn requires phpstan ^1.12.6. That can block PHP 8.0 projects still using larastan 1.0.4 because Larastan 1.0.4 requires PHPStan below 1.9. Projects on PHP 8.1+ with a modern static-analysis stack should be able to upgrade. If you must stay on PHP 8.0 with older Larastan, pin to v6 until the platform is modernized.
- Why does mll-lab/php-utils v7 conflict with larastan 1.0.4?
- The conflict comes from transitive PHPStan requirements, not from Laravel itself. v7 uses spaze/phpstan-disallowed-calls ^4.4, which requires phpstan ^1.12.6, while larastan 1.0.4 requires phpstan below 1.9. Composer cannot resolve both constraints in the same project. Upgrade Larastan and PHPStan first, or pin mll-lab/php-utils to v6 on legacy PHP 8.0 stacks.
- What breaking changes are in mll-lab/php-utils v7?
- v7 bumps the spaze/phpstan-disallowed-calls requirement to ^4.4 and changes how rules.neon is loaded. The file now loads based on whether spaze is installed rather than only on the PHP version. v7 also adds a PHPStan ban on CarbonImmutable, which is opinionated and may surface existing violations. Audit your static-analysis configuration and CarbonImmutable usage before upgrading.
- Does mll-lab/php-utils ban CarbonImmutable?
- Yes, the v7 static-analysis configuration adds a PHPStan ban on CarbonImmutable. That means existing code using CarbonImmutable may start failing analysis until you replace it or adjust your rules. Treat this as a coding-standard change and communicate it to the team. If the ban does not fit your guidelines, review the rules.neon configuration before adopting v7.
- Is rules.neon auto-loaded in Laravel projects?
- The provided evaluation says rules.neon loading is now based on whether spaze/phpstan-disallowed-calls is installed rather than only on the PHP version. So auto-loading behavior depends on your Composer setup and PHPStan configuration. Confirm that spaze is installed as a dev dependency and that your phpstan.neon includes the package rules where expected. Run PHPStan in CI after upgrading to verify the rules are active.
- Should mll-lab/php-utils be a dev dependency or a production dependency?
- Use it as a dev dependency when you only need PHPStan rules, coding-standard enforcement, and CI static analysis. If you also use the helper classes or functions at runtime, install it as a regular dependency. The static-analysis configuration has no runtime application impact. Keep it aligned with your PHPStan and Larastan versions.
- How do I test and maintain mll-lab/php-utils in Laravel CI?
- Start by inventorying PHP, Larastan, PHPStan, and spaze versions in CI. Upgrade Larastan and PHPStan where possible, update spaze/phpstan-disallowed-calls to ^4.4, then upgrade mll-lab/php-utils to v7. Run Composer install and PHPStan in a branch, and address any CarbonImmutable violations or rules.neon loading issues. Pin v6 only where the legacy stack cannot move yet, and keep the dependency aligned with future PHPStan and Larastan upgrades.