satis composer package not found - composer-php

I'm trying to create custom composer packages in order use/update some custom wordpress plugins across all my projects.
I decided on using satis, following this article: https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md
I've installed satis, and successfully generated the webview and deployed it. It shows the two composer packages (git repositories) that were linked with satis.
Problem
When I create a new project and include my custom composer package in my package.json, running composer update returns an error.
Error
composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package namespace/test could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
My package composer.json file:
{
"name": "name",
"type": "project",
"license": "MIT",
"description": "desc",
"authors": [],
"keywords": ["bedrock", "wp"],
"config": {
"preferred-install": "dist"
},
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "composer",
"url": "https://packages.namespace.tld"
}
],
"require": {
"php": ">=5.6",
"composer/installers": "^1.4",
"vlucas/phpdotenv": "^2.0.1",
"johnpbloch/wordpress": "^5.0.2",
"oscarotero/env": "^1.1.0",
"roots/wp-password-bcrypt": "1.0.0",
"roots/wp-config": "1.0.0",
"wpackagist-plugin/contact-form-7": "*",
"namespace/test": "*"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.0.2",
"roave/security-advisories": "dev-master"
},
"extra": {
"installer-paths": {
"www/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"www/app/plugins/{$name}/": ["type:wordpress-plugin"],
"www/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "www/wp"
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"test": [
"phpcs"
]
}
}

Related

Install latest composer dependencies

I have private repository in which we have a composer.json file.
{
"name": "vendor/package",
"version": "1.1.0",
"type": "project",
"require": {
"craftcms/cms": "^3.0.0",
"ether/splash": "^v3.0.2",
"ether/simplemap": "^v3.3.4",
"aelvan/imager": "^v2.1.1",
"vlucas/phpdotenv": "^2.4.0",
"craftcms/redactor": "^2.1.6",
"craftcms/mandrill": "^1.2.0",
"sebastianlenz/linkfield": "^1.0.15",
"solspace/craft3-freeform": "^2.4.1",
"nystudio107/craft-minify": "^1.2.9",
"nystudio107/craft-seomatic": "^3.1.26",
"pieterxjan/slack-error-notifications": "^1.0"
},
"autoload": {
"psr-4": {
"modules\\": "modules/"
}
},
"config": {
"optimize-autoloader": true,
"platform": {
"php": "7.0"
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
}
}
When I perform a composer create-project vendor/package ., it only installs the given requirements as specified in the composer.json file.
In case I want the latest dependencies, I need to perform a composer update after the install is complete. I wonder if there is another way of installing the latest dependencies with only the composer create-package command.
The inspiration of my bootstrap package is Andrew Welch's craft repo. If I install his repo as documented in the readme, I immediately get the latest dependencies, whilst the dependences specified in the composer.json file are older versions.
Is there some setting I'm forgetting that takes care of this?

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

Loading a composer package through a Github fork

I forked a library on Github and now want to load my fork into the project without adding the forked library into packagist. I get the following error after adding the repository and require to my composer.json:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package cnizzardini/ssl-certificate could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Here is my full composer.json
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"cakephp/cakephp": "~3.4",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*",
"guzzlehttp/guzzle": "^6.2",
"donatj/phpuseragentparser": "^0.7.0",
"cnizzardini/ssl-certificate": "dev-master"
},
"require-dev": {
"psy/psysh": "#stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "~1.1",
"phpunit/phpunit": "^5.5"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src",
"Api\\": "./plugins/Api/src",
"Channel\\": "./plugins/Channel/src",
"System\\": "./plugins/System/src",
"Admin\\": "./plugins/Admin/src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests",
"Api\\Test\\": "./plugins/Api/tests",
"Channel\\Test\\": "./plugins/Channel/tests",
"System\\Test\\": "./plugins/System/tests",
"Admin\\Test\\": "./plugins/Admin/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cnizzardini/ssl-certificate.git"
}
],
"minimum-stability": "stable",
"prefer-stable": true
}
I have tried adding https://github.com/cnizzardini/ssl-certificate with and without the .git. I have also tried setting minimum-stability to dev and prefer-stable to false.
Nothing works :-(
The composer.json file on your fork still calls the package "spatie/ssl-certificate", so that's the name of the package you need to require.
This should work:
{
...
"require": {
...
"spatie/ssl-certificate": "dev-master"
},
...
"repositories": [
{
"type": "vcs",
"url": "https://github.com/cnizzardini/ssl-certificate.git"
}
],
...
}
If it doesn't, you can rename the package on your own fork by changing the name property in its composer.json file:
{
"name": "cnizzardini/ssl-certificate",
"description": "A class to easily query the properties of an ssl certificate ",
...
}

packagist laravel package -composer Could not find package

I have created package using Laravel.
The composer.json file for my package will look like this
{
"name": "lakshmajim/testview",
"description": "hi",
"keywords": [
"package"
],
"homepage": "https://github.com/lakshmajim/testview",
"license": "MIT",
"authors": [
{
"name": "lakshmajim",
"email": "lakshmaji9#gmail.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"lakshmajim\\testview\\": "src/"
}
},
"minimum-stability": "dev"
}
then I have pulled to github
then I have linked it to Packagist
when I am running this composer require lakshmajim/testview
it is showing following error message
[InvalidArgumentException]
Could not find package lakshmajim/testview at any version for your minimum-stability (stable). Check the package spelling or your minimum-s
tability
QUESTION:
Why I am getting that error message ,when I'm trying to install using composer?
How can I successfully run composer require lakshmajim/testview
it's a release issue
you must run
composer require lakshmajim/testview dev-master
you don't have a release yet.

Don't work require in Copmposer

I have composer.json on project:
{
"repositories": [
{
"type": "vcs",
"url": "git#git.test.ua:bmp/composer.git"
}
],
"require": {
"pack/composer": "dev-master"
},
"minimum-stability": "dev"
}
git#git.test.ua:bmp/composer.git - it's my repo, that containe next composer.json file:
{
"name": "pack/composer",
"repositories": [
{
"type": "vcs",
"url": "git#git.test.ua:components/curl.git"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"pack/curl": "dev-master"
},
"autoload": {
"psr-4": {
"pack\\composer\\": ""
}
}
}
git#git.test.ua:components/curl.git - also my repo, that containe next composer.json file:
{
"name": "pack/curl",
"autoload": {
"psr-4": {
"pack\\curl\\": ""
}
},
"minimum-stability": "dev"
}
When I try to do composer install on my project, I receive next error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for pack/composer dev-master -> satisfiable by pack/composer[dev-master].
- pack/composer dev-master requires pack/curl dev-master -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
I already add param:
"minimum-stability": "dev"
If I remove require section from the seckond composer.json file the no error any more.
"pack/curl": "dev-master"
How fix it, I need this require?
Update:
{
"repositories": [
{"type": "vcs", "url": "https://git.test.ua/components/composer.git"},
{"type": "vcs", "url": "https://git.test.ua/components/curl.git"}
],
"require-dev": {
"pack/composer": "dev-master"
},
"minimum-stability": "dev"
}
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing pack/composer (dev-master 886d220)
Cloning 886d22082d4aa341731ebd87f280ee0f5a05fe37
Writing lock file
Generating autoload files
Update2 composer.lock file
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is #generated automatically"
],
"hash": "cc5c1fc7000544f6cfd9ba03a3ee4567",
"packages": [],
"packages-dev": [
{
"name": "pack/composer",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://git.test.ua/components/composer.git",
"reference": "886d22082d4aa341731ebd87f280ee0f5a05fe37"
},
"require-dev": {
"pack/curl": "dev-master"
},
"type": "library",
"autoload": {
"psr-4": {
"pack\\composer\\": ""
}
},
"time": "2015-04-24 07:13:31"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"pack/composer": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
Composer does not browse repositories recursively, i.e. ALL repositories that may contain software have to be mentioned in the root composer.json file.
You don't mention the repository of the pack/curl package there, so Composer cannot find this package.
I assume that "pack" is the vendor name you added partially in your question, because the error message still mentions "shkarbatov" as the vendor name.
Best way to avoid having to add hundreds of personal repositories everywhere is to have a packagist-like Composer repo that is mentioned everywhere and contains the metadata of all code repositories. Have a look at Satis.
Update:
Now after seeing your composer.lock file, the situation is clear: You are NOT using require to add your packages, but require-dev. This is for development dependencies (like adding PHPUnit or stuff needed to develop the package) of the root package only - any dev dependencies of packages added to the root package are NOT installed.
Change the dependencies of packages you need for production use to require all levels!

Resources