- What is softrules/php and what problem does it solve?
- softrules/php is a lightweight PHP rules engine for defining and evaluating soft validation rules, described as a PHP implementation of the SoftRules user interfaces. Rather than throwing hard validation failures, it lets a Laravel app flag or score issues so users get advisory feedback. It is distributed on Packagist as softrules/php and is currently at v0.3.0, which is a pre-1.0 release.
- How do I install softrules/php in a Laravel application?
- Install it with Composer, pinning the exact version for safety: composer require softrules/php:0.3.0, then commit your composer.lock. Check the package's composer.json first to confirm its illuminate/* constraints match your Laravel version. The package depends on individual illuminate components rather than laravel/framework, so it will not pull the framework in for you.
- Does softrules/php support Laravel 11 and Laravel 12?
- That is not clearly answered by the v0.3.0 changelog. The release bumps illuminate/http, illuminate/support, and illuminate/collections from the 11.x line through 12.8.1, but it does not state whether Laravel 11 support was dropped or widened. Read the composer.json constraints at the v0.3.0 tag directly, and do not infer compatibility from the changelog. If you are on Laravel 11, verify before upgrading.
- What PHP version do I need for softrules/php?
- The release notes do not state a PHP version floor, so check the require section of composer.json at the v0.3.0 tag. Laravel 12, which the illuminate bumps track, generally requires PHP 8.2 or newer, so that is the realistic baseline. Pin the version and confirm the floor in CI before rolling it out across your estate.
- How do soft rules differ from Laravel's built-in validator?
- Laravel's built-in validator produces pass/fail results and error messages that typically block a request. Soft rules are advisory: they flag or score an issue so your application can warn, rank, or annotate without rejecting input. That makes softrules/php a better fit for quality scoring, compliance hints, or progressive-disclosure warnings than for enforcing mandatory fields.
- Can I use softrules/php outside a full Laravel application?
- The dependency set is illuminate/* components rather than laravel/framework, which is a positive signal for framework decoupling. You can use it in a standalone PHP project as long as those components are present. It will not install the full Laravel framework for you, so you manage the surrounding pieces yourself.
- Is softrules/php safe to use in production at v0.3.0?
- Treat it as usable with caution rather than fully stable. It is pre-1.0, so a minor bump may legitimately contain breaking changes, and the v0.3.0 release consists solely of Dependabot dependency bumps with no human-authored changelog. Pin softrules/php:0.3.0 exactly, commit the lockfile, and read composer.json to establish the real support matrix before adopting. For low-risk, internal advisory checks that approach is reasonable.
- How do I define and configure soft rules with softrules/php?
- Rules are defined in PHP and evaluated by the package, and the README plus source are the authoritative reference because the v0.3.0 notes are dependency-only. Keep rule definitions behind your own service class or config file so a future v0.x change cannot ripple through your codebase. Pin the version and re-read the README whenever you bump.
- How do I test soft validation rules in a Laravel test suite?
- There is no test-suite signal in the release notes, so treat the behaviour you rely on as your own contract. Write feature tests that assert the flags and scores your rules produce for representative inputs, and run them against the pinned version. Because dependency-only bumps can still shift behaviour silently, re-run those tests before any upgrade.
- What should I check before upgrading from softrules/php 0.2.13 to 0.3.0?
- Diff the package's composer.json between v0.2.13 and v0.3.0 first; that one artifact tells you more than the changelog about the illuminate and PHP constraints. Confirm whether Laravel 11 remains supported, and assume the minor bump could be breaking until proven otherwise. Upgrade in a branch with your existing soft-rule tests, and pin 0.3.0 explicitly rather than using a caret constraint.