尝试通过 TYPO3 中的 Composer 安装我自己的扩展 [英] Try to install my own extension via composer in TYPO3

查看:38
本文介绍了尝试通过 TYPO3 中的 Composer 安装我自己的扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 TYPO3 CMScomposer 的第一步...但我无法安装自己的分发包.尝试:

My first steps with TYPO3 CMSand composer... but I cannot install my own distribution package. Try to:

composer require stsa/hellotypo3

我遇到了这个错误:

[InvalidArgumentException]                                                                                           
 Could not find a version of package stsa/hellotypo3 matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.

我已经通过 composer 安装了 TYPO3 9.5.1 并且(为了测试)安装了一个 3rd 方扩展,比如 maskcomposer require mask/mask.它完美运行.

I've install TYPO3 9.5.1 via composer and (for testing) install a 3rd party extension like mask with composer require mask/mask. It works perfectly.

这是我的分发扩展的 composer.json,我已将其上传到 packgist.json-file 是有效的,但必须有.错了..

Here's my composer.json of my distribution extension, which I've uploaded to packgist. The json-file is valid, but there must be sth. wrong ..

{
    "name": "stsa/hellotypo3",
    "type": "typo3-cms-extension",
    "description": "FLUID Templates & TypoScript",
    "homepage": "https://www.hello.de/",
    "keywords": [
        "TYPO3",
        "CMS",
        "extension"
    ],
    "authors": [
        {
            "name": "Stsa",
            "email": "contact@hello.de",
            "role": "Developer",
            "homepage": "https://www.hello.de/"
        }
    ],
    "license": [
        "GPL-2.0-or-later"
    ],
    "require": {
        "typo3/cms-core": "^9.5"
    },
    "autoload": {
        "psr-4": {
            "Stsa\\Hellotypo3\\": "Classes/"
        }
    },
    "replace": {
        "hellotypo3": "self.version",
        "typo3-ter/hellotypo3": "self.version"
    }
}

没办法..它不适用.我也尝试设置 "minimum-stability": "stable".但老实说,我不知道我能做什么..?!有人能帮我吗?谢谢.

No way .. it doesn't work with that. I also try to set "minimum-stability": "stable". But honestly, I have no idea what I can do ..?! Can someone help me? Thanks.

编辑 1:今天我在 packgist 更新了我自己的扩展.现在必须以该供应商/名称提供.

EDIT 1: Today I've update my own extension at packgist. It must be available now with this vendor/name.

编辑 2:现在我通过 sitepackagebuilder 做了一个测试扩展,上传到 git,sumbit 到 packgist.尝试通过 composer require hellotypo3de/hellotest 安装 .. 仍然相同 错误警告:找不到与您的最低稳定性(稳定)匹配的包 hellotypo3de/hellotest 版本.要求它具有明确的版本约束以允许其所需的稳定性. ..?!我的错误在哪里?

EDIT 2: Now I've made a test extension via sitepackagebuilder, upload to git, sumbit to packgist. Try to install via composer require hellotypo3de/hellotest .. still the same Error warning: Could not find a version of package hellotypo3de/hellotest matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability. ..?! Where's my mistake?

推荐答案

可以手动安装本地分发扩展.您必须在require-section"中插入您的扩展,并在您的存储库根目录 composer.json 中的repositories-section"中添加一种新类型的包.看我的例子:

It's possible to install your local distribution extension manually. You have to insert your extension at the "require-section" and add a new type of package at the "repositories-section" in your repsoitory root composer.json. See my example:

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://composer.typo3.org/"
        },
        {
            "type":"package",
            "package": {
              "name": "stsa/hellotypo3",
              "version":"master",
              "source": {
                  "url": "https://github.com/name/hellotypo3-distribution.git",
                  "type": "git",
                  "reference":"dev-master"
                }
            }
        }
    ],
    "name": "typo3/cms-base-distribution",
    "description" : "TYPO3 CMS Base Distribution",
    "license": "GPL-2.0-or-later",
    "config": {
        "platform": {
            "php": "7.2"
        }
    },
    "require": {
        "helhum/typo3-console": "^5.5.5",
        "typo3/minimal": "^9.5",
        "typo3/cms-about": "^9.5",
        "typo3/cms-adminpanel": "^9.5",
        "typo3/cms-belog": "^9.5",
        "typo3/cms-beuser": "^9.5",
        "typo3/cms-felogin": "^9.5",
        "typo3/cms-fluid-styled-content": "^9.5",
        "typo3/cms-form": "^9.5",
        "typo3/cms-impexp": "^9.5",
        "typo3/cms-info": "^9.5",
        "typo3/cms-redirects": "^9.5",
        "typo3/cms-reports": "^9.5",
        "typo3/cms-rte-ckeditor": "^9.5",
        "typo3/cms-setup": "^9.5",
        "typo3/cms-seo": "^9.5",
        "typo3/cms-sys-note": "^9.5",
        "typo3/cms-t3editor": "^9.5",
        "typo3/cms-tstemplate": "^9.5",
        "typo3/cms-viewpage": "^9.5",
        "stsa/hellotypo3": "dev-master"
    },
    "scripts":{
        "typo3-cms-scripts": [
            "typo3cms install:fixfolderstructure",
            "typo3cms install:generatepackagestates"
        ],
        "post-autoload-dump": [
            "@typo3-cms-scripts"
        ]
    },
    "extra": {
        "typo3/cms": {
            "cms-package-dir": "{$vendor-dir}/typo3/cms",
            "web-dir": "public"
        }
    }
}

dev-master 在这里很重要!

来自您的扩展程序的 composer.json 如下所示:

The composer.jsonfrom your extension looks like this:

{
    "name": "stsa/hellotypo3",
    "type": "typo3-cms-extension",
    "description": "FLUID Templates & TypoScript",
    "homepage": "https://www.hellotypo3.de/",
    "keywords": [
        "TYPO3",
        "CMS",
        "extension"
    ],
    "authors": [
        {
            "name": "StSa",
            "email": "hello@hellotypo3.de",
            "role": "Developer",
            "homepage": "https://www.hellotypo3.de/"
        }
    ],
    "license": [
        "GPL-2.0-or-later"
    ],
    "require": {
        "typo3/cms-core": "^9.5"
    },
    "autoload": {
        "psr-4": {
            "Stsa\\Hellotypo3\\": "Classes/"
        }
    },
    "replace": {
        "hellotypo3": "self.version",
        "typo3-ter/hellotypo3": "self.version"
    },
    "extra": {
        "typo3/cms": {
            "extension-key": "hellotypo3"
        }
    }
}

或者你可以从 packgist 安装你的扩展,但不要忘记:

Or you can install your extension from packgist, but don't forget:

composer require stsa/hellotypo3:master-dev@dev

composer req stsa/hellotypo3:@dev

这篇关于尝试通过 TYPO3 中的 Composer 安装我自己的扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆