drupify/version-resolver 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drupify/version-resolver

最新稳定版本:1.1.0

Composer 安装命令:

composer require drupify/version-resolver

包简介

A PHP library for resolving version, supported releases etc. for Drupal Core, modules, themes, and other related projects.

README 文档

README

CI Coverage Status

Drupal Version Resolver Library

The Drupal Version Resolver Library is a PHP library designed to help you easily resolve Drupal project versions, supported releases, and retrieve all releases hosted on Drupal.org. Whether you need to fetch release information for Drupal core or contributed modules/themes, this library offers a simple API to access such data.

Features

  • Fetch supported releases for a given Drupal module or theme.
  • Get all available releases for any Drupal project.
  • Resolve different Drupal core versions, including the current version, development versions, and next minor versions.

Requirements

  • PHP 8.1 and above.
  • Composer for installation.
  • Internet access to query data from drupal.org.

Installation

To install, you can run below command:

composer require drupify/version-resolver

Example Usage

Here’s an example to retrieve the releases of a module hosted on Drupal.org:

use Drupify\Resolver\VersionResolver;

// Initialize the resolver with the project name.
$resolver = new VersionResolver('token');

// Get supported releases for the project.
$supported = $resolver->getSupportedReleases();

// Output format example:
[
  "8.x-1.x" => [
    "stable" => [
      "name" => "token 8.x-1.15",
      "version" => "8.x-1.15",
      "tag" => "8.x-1.15",
      "core_compatibility" => "^9.2 || ^10 || ^11"
    ],
    "dev" => [
      "name" => "token 8.x-1.x-dev",
      "version" => "8.x-1.x-dev",
      "tag" => "8.x-1.x",
      "core_compatibility" => "^9.2 || ^10 || ^11"
    ]
  ]
]

Fetching All Releases

If you need to retrieve all releases (including older versions), you can do so with the following:

$all = $resolver->getAllReleases();

Note: This method returns all releases, but it does not include projects compatible with Drupal Core 7.x and below.

Resolving Drupal Core Versions

The library also provides methods to resolve various types of Drupal core versions:

  • Current Stable: Returns the current stable version (e.g., 10.3).
  • Current Dev: Returns the current development version (e.g., 10.3.x-dev).
  • Next Minor: Returns the next minor version (e.g., 11.0.0-rc1).
  • Next Minor Dev: Returns the next minor development version (e.g., 11.0.x-dev) and so on.

Example usage:

use Drupify\Resolver\CoreVersionResolver;

$resolver = new CoreVersionResolver();

$currentVersion = $resolver->findCurrent();
$currentDevVersion = $resolver->findCurrentDev();
$nextMinorVersion = $resolver->findNextMinor();
$nextMinorDevVersion = $resolver->findNextMinorDev();

Example Output

echo $currentVersion; // 10.3
echo $currentDevVersion; // 10.3.x-dev
echo $nextMinorVersion; // 11.0.0-rc1
echo $nextMinorDevVersion; // 11.0.x-dev

Contact

If you have any questions or issues, feel free to open a GitHub issue or contact the maintainers directly.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固