Skip to content

Filter plugins by NativePHP Mobile 3.x or 4.x and show version pills - #537

Merged
simonhamp merged 1 commit into
mainfrom
plugin-version-filter-pills
Sep 26, 2026
Merged

simonhamp merged 1 commit into
mainfrom
plugin-version-filter-pills

Conversation

@simonhamp

Copy link
Copy Markdown
Member

The marketplace's version filter found nothing for "4.x and up" in production. Plugins store the raw nativephp/mobile constraint from their composer.json in mobile_min_version (^3.0 || ^4.0, ^4.0, *), and the filter searched it with LIKE '4.%', which none of those values match.

Plugins now have a mobile_versions JSON column with the lowest release they allow in each major version, e.g. {"3": "3.2.1", "4": "4.0"}. It's worked out from the stored composer.json by a small parser in App\Support\ComposerConstraint. The sync fills it in, and php artisan plugins:backfill-mobile-versions fills it for existing plugins from the composer.json we already have, without calling GitHub.

The filter now offers All NativePHP Versions, NativePHP 4.x and NativePHP 3.x, and a plugin shows under every major it supports. "Version Unspecified" and the 2.x and 1.x options are gone. Old links with those values show every plugin.

Plugin cards and plugin page headers show a pill per major with the lowest version, e.g. (3.0) (4.5.2). The pills use the phone icon from the nav's Mobile menu, so desktop plugins can get the Desktop icon later.

Things to watch:

  • A plugin supports a major if Composer would let it install any release of it. So * and >=3.0 count as both 3.x and 4.x and get 3.0 and 4.0 pills. nativephp/mobile-firebase requires *.
  • I wrote the parser rather than use composer/semver, because that's only installed as a dev dependency (through laravel/roster) and wouldn't be there in production. It handles ^, ~, wildcards, comparisons, hyphen ranges and |/||, and skips branch names like dev-main. Swapping composer/semver in would be easy if we'd rather add the dependency.
  • Only the majors in config('plugins.mobile_major_versions') are checked, now [4, 3] since plugins arrived in v3. When 5.x ships, add it there and run the backfill again.
  • The sidebar's "NativePHP Mobile" row and the OG image still show the raw constraint.
  • Two old directory tests covered the exact "4" match and the unspecified option. They're replaced with tests for the new behaviour.

After deploying: run the migration, then php artisan plugins:backfill-mobile-versions --dry-run, check the table, then run it without --dry-run.

Testing: new tests cover the parser (including the constraint styles real plugins use on GitHub and Packagist), the sync, the backfill command, the filter, and the pills on cards and plugin pages. The plugin-related tests pass locally. I haven't run the full suite. I tried the filter and plugin page in the local preview, but only checked the card pills and the phone icon in the rendered HTML.

🤖 Generated with Claude Code

The version filter matched the raw composer constraint (e.g. "^3.0 || ^4.0")
with LIKE '4.%', so 4.x found nothing. Plugins now store the lowest release
they allow in each major, worked out from their composer.json, and the filter,
cards and plugin headers use that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp marked this pull request as ready for review September 26, 2026 14:32
@simonhamp
simonhamp merged commit 7e98d43 into main Sep 26, 2026
3 checks passed
@simonhamp
simonhamp deleted the plugin-version-filter-pills branch September 26, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant