use*_*852 7 typo3 composer-php typo3-extensions typo3-9.x
我的第一步是TYPO3 CMS...composer但是我无法安装我自己的发行包。尝试:
composer require stsa/hellotypo3
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
[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.
Run Code Online (Sandbox Code Playgroud)
我已经TYPO3 9.5.1通过 Composer 安装并(用于测试)安装了第 3 方扩展,mask例如composer require mask/mask. 它工作完美。
这是我composer.json的分发扩展,我已将其上传到packgist. json 文件是有效的,但必须有某物。错误的 ..
{
"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"
}
}
Run Code Online (Sandbox Code Playgroud)
没办法..这不起作用。我也尝试设置一下"minimum-stability": "stable"。但说实话,我不知道我能做什么..?!有人能帮我吗?谢谢。
编辑 1:今天我在 packgist 更新了我自己的扩展。它现在必须可以通过该供应商/名称获得。
编辑2:现在我已经通过sitepackagebuilder进行了测试扩展,上传到 git,提交到 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...?!我的错误在哪里?
我假设您只想在一次安装中使用您的扩展作为本地扩展。这就是要走的路:
创建一个目录,例如packages在项目的根目录中。
将您的扩展移至此目录并命名该文件夹stsa-hellotypo3。破折号前面的部分是你的命名空间,后面的部分是包名称。
composer.json将以下条目添加到您的扩展中:
"extra": {
"typo3/cms": {
"extension-key": "stsa_hellotypo3"
}
}
Run Code Online (Sandbox Code Playgroud)
现在 TYPO3 将用作stsa_hellotypo3扩展密钥。
将条目更改composer.json为 TYPO3 项目根repositories目录中的文件:
"repositories": [
{
"type": "path",
"url": "packages/*"
},
{
"type": "composer",
"url": "https://composer.typo3.org/"
}
],
Run Code Online (Sandbox Code Playgroud)
作曲家现在将查看packages文件夹中是否有要安装的包。
现在您可以将扩展添加到项目中:
composer require stsa/hellotypo3:@dev
Run Code Online (Sandbox Code Playgroud)
该扩展在typo3conf/ext/目录中被符号链接为stsa_hellotypo3。安装开发版本后@dev(您已经拥有)。您还可以在扩展composer.json文件中添加版本条目,然后可以省略@dev.
如果您这样做,则不必将扩展程序的自动加载信息添加到根composer.json 文件中。
可以手动安装本地分发扩展。您必须在 repository root 的“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"
}
}
}
Run Code Online (Sandbox Code Playgroud)
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"
}
}
}
Run Code Online (Sandbox Code Playgroud)
或者您可以从 packgist 安装扩展,但不要忘记:
composer require stsa/hellotypo3:master-dev@dev
Run Code Online (Sandbox Code Playgroud)
或者
composer req stsa/hellotypo3:@dev
Run Code Online (Sandbox Code Playgroud)