4

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

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.

我已经TYPO3 9.5.1通过 composer 安装并(用于测试)安装了一个 3rd 方扩展mask,如composer require mask/mask. 它完美地工作。

这是我composer.json的分发扩展,我已上传到packgist. json-file是有效的,但是一定有的。错误的 ..

{
    "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". 但老实说,我不知道我能做什么..?!有人能帮我吗?谢谢。

编辑 1:今天我在 packgist 更新了我自己的扩展。它现在必须与此供应商/名称一起可用。

编辑2:现在我通过sitepackagebuilder做了一个测试扩展,上传到git,sumbit到packgist。尝试通过composer require hellotypo3de/hellotest.. 安装仍然相同的错误警告: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...?! 我的错在哪里?

4

3 回答 3

4

我假设您只想在一个安装中使用您的扩展作为本地扩展。所以这就是要走的路:

  1. 创建一个目录,例如packages在您项目的根目录中。

  2. 将您的扩展移动到此目录并命名文件夹stsa-hellotypo3。破折号之前的部分是您的命名空间,包名称后面的部分。

  3. composer.json将以下条目添加到您的扩展程序中:

    "extra": {
        "typo3/cms": {
            "extension-key": "stsa_hellotypo3"
        }
    }
    

    现在 TYPO3 将stsa_hellotypo3用作扩展密钥。

  4. 将条目更改为composer.jsonTYPO3 项目根目录中的文件repositories

    "repositories": [
        {
            "type": "path",
            "url": "packages/*"
        },
        {
            "type": "composer",
            "url": "https://composer.typo3.org/"
        }
    ],
    

    composer 现在将查看packages要安装的软件包的文件夹。

  5. 现在您可以将扩展添加到项目中:

    composer require stsa/hellotypo3:@dev
    

    该扩展在typo3conf/ext/ 目录中被符号链接为stsa_hellotypo3。随着@dev开发版本的安装(你有)。您还可以在扩展composer.json文件中添加版本条目,然后可以省略@dev.

如果您这样做,则不必将扩展的自动加载信息添加到根 composer.json 文件中。

于 2018-11-24T19:00:54.197 回答
2

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

{
    "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扩展程序中的内容如下所示:

{
    "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 安装你的扩展,但不要忘记:

composer require stsa/hellotypo3:master-dev@dev

或者

composer req stsa/hellotypo3:@dev
于 2018-11-30T07:17:39.387 回答
0
"require": {
        "typo3/cms-core:^9.5"
    },

那样有用吗?如果不是sry,但希望它有所帮助

于 2018-11-24T14:15:58.297 回答