Search by

adachsoft / release-validator-packagist-checks

Arkadiusz Adach

Release-validator checks verifying a package's state in the Packagist registry (version presence, SemVer freshness) before publishing.

Package info

gitlab.com/a.adach/release-validator-packagist-checks

Issues

pkg:composer/adachsoft/release-validator-packagist-checks

Statistics

Installs: 23

Dependents: 1

Suggesters: 0

Stars: 0

v0.3.0 2026-09-23 16:30 UTC

This package is auto-updated.

Last update: 2026-09-23 16:33:08 UTC


README

Release Validator Packagist Checks provides release validators for Composer packages published on Packagist.

Features

  • Verify that a release version does not already exist in the Packagist registry.
  • Verify that a release version is newer than the latest semantic version registered on Packagist.
  • Resolve the Composer package name automatically from composer.json.
  • Configure a static package name when the repository path does not contain the package metadata.
  • Integrate Packagist checks with the adachsoft/release-validator validation workflow before publishing a release.

Installation

composer require adachsoft/release-validator-packagist-checks

Usage

Create the standard Packagist validator collection with a Packagist API client:

use AdachSoft\ReleaseValidatorPackagistChecks\Factory\PackagistValidatorFactory;

$validators = PackagistValidatorFactory::createValidators($packagistApiClient);

By default, the factory uses ComposerJsonPackageNameResolver, which reads the package name from the composer.json file in the repository path provided by the release validation context.

When the package name should be configured explicitly, provide a StaticPackageNameResolver:

use AdachSoft\ReleaseValidatorPackagistChecks\Factory\PackagistValidatorFactory;
use AdachSoft\ReleaseValidatorPackagistChecks\Resolver\StaticPackageNameResolver;

$validators = PackagistValidatorFactory::createValidators(
    $packagistApiClient,
    new StaticPackageNameResolver('vendor/package'),
);

Custom resolvers can implement PackageNameResolverInterface and be passed as the second argument to the factory.

Validators

The package includes the following validators:

  • RegistryVersionDoesNotExistValidator — verifies that the release version is not already registered on Packagist.
  • VersionIsNewerThanLatestValidator — verifies that the release version is newer than the latest registered semantic version.

Both validators use adachsoft/packagist-api-client and implement the standard ReleaseValidatorInterface contract from adachsoft/release-validator. They are intended to run before creating a Git tag and before publishing the package to Packagist.

The validators require a PackageNameResolverInterface implementation. Use PackagistValidatorFactory for the standard configuration, or instantiate the validators directly when custom wiring is required.

Package Name Resolvers

  • ComposerJsonPackageNameResolver reads and validates the name field from composer.json.
  • StaticPackageNameResolver returns a configured package name in vendor/package format.
  • PackageNameResolverInterface defines the resolver contract for custom implementations.

Requirements

  • PHP 8.3 or newer
  • A valid Composer package name in vendor/package format
  • Network access to the Packagist API when validations are executed

License

This package is released under the MIT License. See the LICENSE file for details.