承接 dd/evolutioncms-libraries-ddinstaller 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dd/evolutioncms-libraries-ddinstaller

Composer 安装命令:

composer require dd/evolutioncms-libraries-ddinstaller

包简介

The library for install and update snippets, plugins and libraries.

README 文档

README

The library for installing and updating snippets, plugins, and libraries from GitHub and GitLab repositories.

How it works

Terms

  • “Site” — your site.
  • “Resource” — snippet, plugin or library that you want to install or update.

Algorithm

  1. First, the library downloads the repository archive of Resource from GitHub or GitLab using API and temporary saves it in assets/cache/ddInstaller/.
  2. Then it decides whether to install / update Resource or not.
    To do this it looks at the composer.json file from the archive and compares with composer.json of Resource on your Site:
    • Resource will be installed or updated if:
      1. composer.json in the archive:
        • Is exist.
        • And not empty.
        • And contains the valid version field.
      2. composer.json on Site:
        • Is not exist.
        • Or empty.
        • Or doesn't contain the version field.
        • Or the version field is invalid.
      3. version in the archive > version on Site.
    • Otherwise, Resource will not be installed.
  3. To avoid accumulation of trash files, the library removes the existing Resource folder before installation and creates it again (e. g. assets/snippets/ddGetDate/).
  4. If Resource is a snippet or plugin, the library tries to find its DB file (e. g. ddGetDate_snippet.php) and installs / upates it to DB.
  5. Finally, the library copies remaining files and subfolders to the Resource folder.

Requires

Installation

Elements → Manage Files:

  1. Create a new folder assets/libs/ddInstaller/.
  2. Extract the archive to the folder.

Parameters description

\DDInstaller::install($params)

Installs or updates needed snippet, plugin, or library.

  • $params

    • Description: Parameters, the pass-by-name style is used.
    • Valid values:
      • arrayAssociative
      • object
      • stringJsonObject — as JSON
      • stringHjsonObject — as HJSON
      • stringQueryFormatted — as Query string
    • Required
  • $params->url

    • Description: Resource GitHub or GitLab URL.
      • Repository root URL only — without /-/tree/..., /-/blob/... and other path suffixes.
      • E. g. 'https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetDate'
      • E. g. 'https://gitlab.com/DivanDesign/SomeGroup/EvolutionCMS.snippets.ddGetDate'
    • Valid values: stringUrl
    • Required
  • $params->revision

    • Description: The branch name, tag name, or commit hash to retrieve.
      • If you specify anything other than 'master'/'main' or any version tag, the distributive will be installed regardless of the composer.json version. This is useful for installing developer versions.
    • Valid values: string
    • Default value: 'master'
  • $params->type

    • Description: Resource type.
      • The parameter is case insensitive.
      • If $params->url contain the following words, you can avoid this parameter and the method will detect type automatically:
        • 'snippet', 'snippets''snippet'
        • 'plugin', 'plugins''plugin'
        • 'library', 'libraries''library'
    • Valid values:
      • 'snippet'
      • 'plugin'
      • 'library'
      • any empty value — will be auto detected from $params->url
    • Default value: —
  • $params->token

    • Description: Access token for private repositories.
      • GitHub: Personal Access Token (classic: repo scope, fine-grained: Contents: Read-only).
      • GitLab: Personal Access Token with read_api scope (archive API does not accept read_repository, see gitlab#28324).
    • Valid values: string
    • Default value: —

Returns

  • $result
    • Description: Installation status.
    • Valid values:
      • true — if the resource is installed or updated successfully
      • false — if something went wrong or the resource on Site is already up to date

Examples

GitHub: Install or update the ddGetDate snippet

Just run the following PHP code in your sources or Console:

// Include (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
	$modx->getConfig('base_path')
	. 'assets/libs/ddInstaller/require.php'
);

// Install (MODX)EvolutionCMS.snippets.ddGetDate
\DDInstaller::install([
	'url' => 'https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetDate',
]);
  • If ddGetDate is not exist on your Site, the library will just install it.
  • If ddGetDate is already exist on your Site, the library will check it version and update it if needed.

GitLab: Install or update

// Include (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
	$modx->getConfig('base_path')
	. 'assets/libs/ddInstaller/require.php'
);

// Install from gitlab.com
\DDInstaller::install([
	// This is not a valid URL, just an example
	'url' => 'https://gitlab.com/DivanDesign/SomeGroup/EvolutionCMS.snippets.ddGetDate',
]);

Private repository

// Include (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
	$modx->getConfig('base_path')
	. 'assets/libs/ddInstaller/require.php'
);

// GitHub
\DDInstaller::install([
	'url' => 'https://github.com/org/EvolutionCMS.snippets.ddGetDate',
	// Your GitHub Personal Access Token
	'token' => 'ghp_xxxxxxxx',
]);

// GitLab
\DDInstaller::install([
	'url' => 'https://gitlab.com/group/EvolutionCMS.snippets.ddGetDate',
	// Your GitLab Personal Access Token
	'token' => 'glpat-xxxxxxxx',
]);

Links

dd/evolutioncms-libraries-ddinstaller 适用场景与选型建议

dd/evolutioncms-libraries-ddinstaller 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「installer」 「updater」 「modx」 「MODX Evo」 「evo」 「modx evolution」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dd/evolutioncms-libraries-ddinstaller 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dd/evolutioncms-libraries-ddinstaller 我们能提供哪些服务?
定制开发 / 二次开发

基于 dd/evolutioncms-libraries-ddinstaller 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-04-13