Try to install my own extension via composer in TYPO3 - composer-php

My first steps with TYPO3 CMSand composer... but I cannot install my own distribution package. Try to:
composer require stsa/hellotypo3
I've got this error:
[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.
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.
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"
}
}
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.
EDIT 1: Today I've update my own extension at packgist. It must be available now with this vendor/name.
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?

I assume you want to use your extension only on one installation as local extension. So that's the way to go:
Create a directory, e.g. packages in your project's root directory.
Move your extension into this directory and name the folder stsa-hellotypo3. The part before the dash is your namespace, the part behind the package name.
Add to your composer.json of your extension the following entry:
"extra": {
"typo3/cms": {
"extension-key": "stsa_hellotypo3"
}
}
Now TYPO3 will use stsa_hellotypo3 as extension key.
Change into your composer.json file in your TYPO3 project root the repositories entry:
"repositories": [
{
"type": "path",
"url": "packages/*"
},
{
"type": "composer",
"url": "https://composer.typo3.org/"
}
],
composer will look now into the packages folder for packages to install.
Now you can add your extension to the project:
composer require stsa/hellotypo3:#dev
The extension is symlink'ed as stsa_hellotypo3 in typo3conf/ext/ directory. With the #dev the development version is installed (which you have). you can also add a version entry into your extension's composer.json file, then you can omit the #dev.
If you do it that way you don't have to add your extension's autoloading information to the root composer.json file.

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 is here important!
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"
}
}
}
Or you can install your extension from packgist, but don't forget:
composer require stsa/hellotypo3:master-dev#dev
or
composer req stsa/hellotypo3:#dev

"require": {
"typo3/cms-core:^9.5"
},
Does that work? If not sry, but hope it helps

Related

TYPO3 8.7.16: class from extension is not available

I try to load own extensions via composer.json but when I run the application I always get this error:
#1411840171: The class "Bm\AhContentelements\Rendering\VideoTagRenderer" you are trying to
register is not available
I load my ah contentelements extension in json as:
{
"repositories": [
{
"type": "composer",
"url": "https://composer.typo3.org/"
},
{
"type": "package",
"package": {
"name": "Bm/ah-content-api",
"version": "0.0.1",
"type": "typo3-cms-extension",
"source": {
"url": "https://user#bitbucket.org/u/ah_config_typo3.git",
"type": "git",
"reference": "master"
}
}
},
{
"type": "package",
"package": {
"name": "Bm/ah-contentelements",
"version": "0.0.1",
"type": "typo3-cms-extension",
"source": {
"url": "https://user#bitbucket.org/u/ah_contentelements_typo3.git",
"type": "git",
"reference": "master"
}
}
}
],
"name": "typo3/cms-base-distribution",
"description": "TYPO3 CMS Base Distribution",
"license": "GPL-2.0-or-later",
"require": {
"helhum/typo3-console": "^4.9.3 || ^5.2",
"typo3/cms-about": "^8.7.10",
"typo3/cms-belog": "^8.7.10",
"typo3/cms-beuser": "^8.7.10",
"typo3/cms-context-help": "^8.7.10",
"typo3/cms-documentation": "^8.7.10",
"typo3/cms-felogin": "^8.7.10",
"typo3/cms-fluid-styled-content": "^8.7.10",
"typo3/cms-form": "^8.7.10",
"typo3/cms-func": "^8.7.10",
"typo3/cms-impexp": "^8.7.10",
"typo3/cms-info": "^8.7.10",
"typo3/cms-info-pagetsconfig": "^8.7.10",
"typo3/cms-rte-ckeditor": "^8.7.10",
"typo3/cms-setup": "^8.7.10",
"typo3/cms-sys-note": "^8.7.10",
"typo3/cms-t3editor": "^8.7.10",
"typo3/cms-tstemplate": "^8.7.10",
"typo3/cms-viewpage": "^8.7.10",
"typo3/cms-wizard-crpages": "^8.7.10",
"typo3/cms-wizard-sortpages": "^8.7.10",
"typo3/cms": "^8.7",
"dmitryd/typo3-realurl": "2.*",
"GridElementsTeam/Gridelements": "8.2.*",
"clickstorm/cs_seo": "3.*",
"Bm/ah-content-api": "0.0.1",
"Bm/ah-contentelements": "0.0.1"
},
"scripts": {
"typo3-cms-scripts": [
"typo3cms install:fixfolderstructure",
"typo3cms install:generatepackagestates"
],
"post-autoload-dump": [
"#typo3-cms-scripts"
]
},
"extra": {
"typo3/cms": {
"web-dir": "public"
},
"helhum/typo3-console": {
"comment": "This option is not needed ay more for helhum/typo3-console 5.x",
"install-extension-dummy": false
}
},
"autoload": {
"psr-4": {
"Bm\\AhContentelements\\": "public/typo3conf/ext/ah-contentelements/Classes",
"Bm\\AhContentapi\\": "public/typo3conf/ext/ah-contentapi/Classes"
}
}
}
What do I wrong, I'm struggling with this for days now..
I never did it the way you did it. I always include a composer.json in each of my extensions. There the autoload part looks like this:
"autoload": {
"psr-4": {
"Bm\\AhContentelements\\": "Classes"
}
}
In the repositories section of my main composer.json I then have something like this:
{
"type": "path",
"url": "./packages/*"
},
I then require my extension with composer require Bm/ah-contentelements:"#dev". Composer then searches the packages directory for the specified extension.
I think the path is wrong: you have to use the root (the directory on the same level like your composer file and the vendor directory) like "web" or "html".
so instead of
"autoload": {
"psr-4": {
"Bm\\AhContentelements\\": "typo3conf/ext/ah-contentelements/Classes",
"Bm\\AhContentapi\\": "typo3conf/ext/ah-contentapi/Classes"
}
you should use something like
"autoload": {
"psr-4": {
"Bm\\AhContentelements\\": "web/typo3conf/ext/ah-contentelements/Classes",
"Bm\\AhContentapi\\": "web/typo3conf/ext/ah-contentapi/Classes"
}
After changing do not forget to composer dump-autoload

composer outdated without install

I'd like to fetch the composer.lock (& .json) from a project, and run some test to see if there is outdated packages in it.
the composer outdated seems to require me to install all packages first,
but that seams a bit overkill, as all needed information should be in the composer.lock-file.
Is there information avaible after an install, thats not avaible from the lock-file?
Is it posible to find outdated packages without running the composer install?
Update 1
I take "foolz/sphinxql-query-builder" as an exemple from one project.
In composer.json there is a
require['foolz/sphinxql-query-builder'] = '^1.0'.
In composer.lock there is a
packages[] = {name: foolz/sphinxql-query-builder, version: '1.0.2', ...}
In ~/.cache/composer/repo/https---packagist.org/p-provider-2018-04.json there is a providers['foolz/sphinxql-query-builder']->sha256
In ~/.cache/composer/repo/https---packagist.org/provider-foolz\$sphinxql-query-builder.json there is a
packages['foolz/sphinxql-query-builder']->$version
From that file i can run
array_keys((array) $json->packages->{'foolz/sphinxql-query-builder'})
to get a list of availible versions.
So how do i fetch the latest 'provider-foolz\$sphinxql-query-builder.json' file?
Composer.lock defines the exact versions of your packages, so only with this file you are not able to define if it is possible to upgrade the package to a new tag version
For example,
In composer.json you have this version of package
"laravelium/sitemap": "^3.0",
In composer lock there exists this information
{
"name": "laravelium/sitemap",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://gitlab.com/Laravelium/Sitemap.git",
"reference": "b287ec4a6b47dcd63fd121199c05e059c479bc6f"
},
"dist": {
"type": "zip",
"url": "https://gitlab.com/api/v4/projects/Laravelium%2FSitemap/repository/archive.zip?sha=b287ec4a6b47dcd63fd121199c05e059c479bc6f",
"reference": "b287ec4a6b47dcd63fd121199c05e059c479bc6f",
"shasum": ""
},
"require": {
"illuminate/support": "5.7.*",
"php": ">=7.1.3"
},
"require-dev": {
"orchestra/testbench": "3.7.*",
"phpunit/phpunit": "~7.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Laravelium\\Sitemap\\SitemapServiceProvider"
]
}
},
"autoload": {
"psr-0": {
"Laravelium\\Sitemap": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roumen Damianoff",
"email": "roumen#damianoff.com",
"homepage": "https://damianoff.com",
"role": "Developer"
}
],
"description": "Laravelium Sitemap package for Laravel.",
"homepage": "https://laravelium.com",
"keywords": [
"Sitemap",
"generator",
"google-news",
"html",
"laravel",
"laravelium",
"php",
"xml"
],
"time": "2018-09-04T19:08:44+00:00"
},
Note, that you will install version v3.{\d+} (>=3 && <4) if it exists, and new tag version may have incompatible change
composer show -l returns the list of packages. Coloured red packages can be updated, and colored green are on the latest version.
Nevertheless, you steel need to proceed with composer install, because only this way you can understand the exact versions of installed packages

Composer, Could not find a version of package

i have private repository with some files that are not important now, what i want to create is package to include it to composer.json
{
"name": "pm/multi-curl",
"description": "Package to multicurl",
"version": "master",
"type": "library",
"minimum-stability":"dev",
"require": {
"ext-curl": "^7.1"
},
"repositories": [
{
"type": "package",
"package": {
"name": "pm/multi-curl",
"version": "dev-master",
"source": {
"url": "git#pmgit.pm.com:dk/multicurl.git",
"type": "git",
"reference": "master"
},
"autoload": {
"psr-0" : {
"PM\\MultiCurl" : "src"
}
}
}
}
],
"authors": [
{
"name": "dk",
"email": "dk#example.com"
}
]
}
but when i execute composer require pm/multi-curl composer gives me this message Could not find a version of package pm/multi-curl matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability. i tried to change stability to dev but that didn't help at all. I also tried to do it with composer.json that looks like this:
{
"name": "pm/multi-curl",
"description": "Package to multicurl",
"version": "master",
"type": "library",
"minimum-stability":"dev",
"require": {
"ext-curl": "^7.1"
},
"authors": [
{
"name": "dk",
"email": "dk#example.com"
}
]
}
pmgit.pm.com is gitlab and to inform you when i execute composer search performance-media/multi-curl it returns correct description. What i do wrong.
do you can use the master branch by
composer require pm/multi-curl:dev-master

The requested amz/amazon-pay-module could not be found in any version, there may be a typo in the package name

I am trying to install a website from server to localhost. When I run the command composer update in git-bash then I get the following error. Please check the screenshot.enter image description here
All the other modules got installed properly only these three are causing issue.
I have checked several threads similar to this issue, found many answers but none worked in my case.
Here is my composer.json file
{
"name": "magento/project-community-edition",
"description": "eCommerce Platform for Growth (Community Edition)",
"type": "project",
"version": "2.1.11",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/product-community-edition": "2.1.12",
"composer/composer": "#alpha",
"magepal/magento2-customshippingrate": "^1.3",
"mestrona/magento-module-categoryredirect": "^2.1",
"amzn/amazon-pay-and-login-with-amazon-core-module": "1.2.5",
"amzn/login-with-amazon-module": "1.2.5",
"amzn/amazon-pay-module": "1.2.5"
},
"require-dev": {
"phpunit/phpunit": "4.1.0",
"squizlabs/php_codesniffer": "1.5.3",
"phpmd/phpmd": "#stable",
"pdepend/pdepend": "2.4.0",
"fabpot/php-cs-fixer": "~1.2",
"lusitanian/oauth": "~0.3 <=0.7.0",
"sebastian/phpcpd": "2.0.0"
},
"config": {
"use-include-path": true
},
"autoload": {
"psr-4": {
"Magento\\Framework\\": "lib/internal/Magento/Framework/",
"Magento\\Setup\\": "setup/src/Magento/Setup/",
"Magento\\": "app/code/Magento/"
},
"psr-0": {
"": "app/code/"
},
"files": [
"app/etc/NonComposerComponentRegistration.php"
]
},
"autoload-dev": {
"psr-4": {
"Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
"Magento\\Tools\\": "dev/tools/Magento/Tools/",
"Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
"Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
}
},
"minimum-stability": "alpha",
"prefer-stable": true,
"repositories": [
{
"type": "composer",
"url": "https://repo.magento.com/"
}
],
"extra": {
"magento-force": "override"
}
}
If anyone have any idea then please guide me in the right direction. I am really stuck into it.
Please install amz-pay the latest extension which supports php latest version.Instead of, installing from composer please put through files.

composer installs own TYPO3 extension in wrong path

I have a own TYPO3 extension hosted on bitbucket. Getting this via composer works (see here for input). The extension is downloaded into my vendor folder. Being there i cannot install the extension via extension-manager.
How can I getting my ext into typo3conf/ext (ensuring autoloading will work)?
The extensions coming via
{
"type": "composer",
"url": "http://composer.typo3.org/"
}
are going to (as expected):
web/typo3config/ext
here is my project composer.json:
{
"repositories": [
{
"type": "composer",
"url": "http://composer.typo3.org/"
},
{
"type": "package",
"package": {
"name": "metaxos/exaibbrplus",
"version": "dev-2016",
"source": {
"url": "https://metaxos#bitbucket.org/metaxos/exaibbrplus.git",
"type": "git",
"reference": "release/2016"
}
}
}
],
"name": "Metaxos/ibbrating2016",
"require": {
"typo3/cms": "7.6.2",
"bk2k/bootstrap-package" : "dev-master",
"typo3-ter/compatibility6" : "7.6.0",
"typo3-ter/extension-builder" : "7.6.0",
"metaxos/exaibbrplus": "dev-2016"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
}
}
}
here is my extension composer.json:
{
"name": "metaxos/exaibbrplus",
"description": "custom ext for typo3",
"type": "typo3-cms-extension",
"version": "0.0.1",
"require": {
"typo3/cms-core": ">=7.6.0,<8.0"
},
"replace": {
"extkey": "self.version",
"typo3-ter/extkey": "self.version"
},
"autoload": {
"psr-4": {
"Metaxos\\Exaibbrplus\\": "Classes/"
}
},
"keywords": ["custom", "ext"],
"homepage": "http://www.blah.ch"
}
For Composer to install the package in web/typo3conf/ext, the package needs to have the type typo3-cms-extension. In your extension's composer.json this type is actually declared, however Composer will not respect it because you explicitly declare the package configuration in your project-level composer.json:
"repositories": [
# ...
{
"type": "package",
"package": {
"name": "metaxos/exaibbrplus",
"version": "dev-2016",
"source": {
"url": "https://metaxos#bitbucket.org/metaxos/exaibbrplus.git",
"type": "git",
"reference": "release/2016"
}
}
}
]
As you're using "type": "package" for your own repository, I suspect that Composer ignores the composer.json from that package. As you already have a Git repository that contains a composer.json, I'd suggest adding the repository using the vcs type instead:
"repositories": [
{
"type": "vcs",
"url": "https://metaxos#bitbucket.org/metaxos/exaibbrplus.git"
}
]
When doing that, Composer should use the composer.json from that repository, recognize the correct package type (typo3-cms-extension) and install the package in the correct directory.
You need to add the type key with the value typo3-cms-extension to the root composer.json. This will place your extension in web/typo3conf/ext instead of vendor/$vendor/$package which in turn will make it available to the cms.
It is important, to know that if you redefine the package in the root composer.json as repository type package, nothing from the extensions' composer.json file will be taken into account and you need to define any concerns about that package in the root composer.json.
So-applying the rules I mentioned above, your root composer.json will look like that:
{
"repositories": [
{
"type": "composer",
"url": "http://composer.typo3.org/"
},
{
"type": "package",
"package": {
"name": "metaxos/exaibbrplus",
"version": "dev-2016",
"type": "typo3-cms-extension",
"source": {
"url": "https://metaxos#bitbucket.org/metaxos/exaibbrplus.git",
"type": "git",
"reference": "release/2016"
},
"autoload": {
"psr-4": {
"Metaxos\\Exaibbrplus\\": "Classes/"
}
},
}
}
],
"name": "Metaxos/ibbrating2016",
"require": {
"typo3/cms": "7.6.2",
"bk2k/bootstrap-package" : "dev-master",
"typo3-ter/compatibility6" : "7.6.0",
"typo3-ter/extension-builder" : "7.6.0",
"metaxos/exaibbrplus": "dev-2016"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "web"
}
}
}
As mentioned above by #helmbert, you are either left with completely redefining the package or using another repository type. You may want to consider using satis or a URL repository.
try to add
"replace": {
"exaibbrplus": "self.version",
"typo3-ter/exaibbrplus": "self.version"
},
And use only "Metaxos\\Exaibbrplus\\": "Classes/" in the autoloader.

Resources