Add github repository to my composer project - github

I like to create a new composer project. I will include code, that is not on packagist. It is a github repository. Concretely I like to include this release.
https://github.com/joomla/joomla-cms/releases/tag/4.0.0-alpha12
I expected with this composer.json to fetch the release 4.0.0-alpha12:
{
"name": "vendor/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "git",
"url": "https://github.com/joomla/joomla-cms.git"
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}
But the command comoser install did not run to the end. This is my message
composer install
Loading composer repositories with package information
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "git clone --mirror 'https://github.com/joomla/joomla-cms.git' '/home/astrid/.composer/cache/vcs/htt
ps---github.com-joomla-joomla-cms.git/'" exceeded the timeout of 300 seconds.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
In the end I have a vendor directory in my project folder. The content of the github repository is not there.
What do I have to do if I want to add code - hosted on github - to my Composer project?
Update
I just changed my composer.json to
{
"name": "astrid/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "package",
"package": {
"name": "joomla/joomla-cms",
"version": "4.0.0-alpha12",
"source": {
"type": "git",
"url": "git://github.com/joomla/joomla-cms.git",
"reference": "4.0-dev"
},
"dist": {
"url": "https://github.com/joomla/joomla-cms/releases/download/4.0.0-alpha12/Joomla_4.0.0-alpha12-Alpha-Full_Package.zip",
"type": "zip"
}
}
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}
Now I get this error.
composer install
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 joomla/joomla-cms dev-4.0-dev#4.0.0-alpha12 exists as joomla/joomla-cms[4.0.0-alpha12] but these are rejected by your constraint.
What am I doing wrong? I haven't assigned any dependencies or restrictions yet.

I'm not sure what exactly causes your "rejected by your constraint" exception, but I'm guessing it's because you're using the branch#ref version requirement which the docs say isn't actively supported. I think you could rather just use the 4.0.0-alpha12 tag since a tag isn't tied to a branch.
To fix your first issue, change your repository type to vcs (or github). Composer will detect the the repository is a Github repository and will then use the Github API to fetch the correct version of the package. The joomla-cms repository looks really big so it will probably take longer than the allowed 300 seconds to clone.
"repositories": [
{
"type": "vcs",
"url": "https://github.com/joomla/joomla-cms.git"
}
]
For your second issue, set your version to 4.0.0-alpha12:
"require": {
"joomla/joomla-cms": "4.0.0-alpha12"
}
The 4.0.0-alpha12 version of joomla-cms requires a dev version of joomla/application (joomla/application[2.0.x-dev]) so you would have to set your package's minimum stability to dev:
"minimum-stability": "dev",

Related

My pulumi stack was created with an older plugin version that I can't install on M1 mac

I have a Pulumi project which I haven't touched (deployed etc) for a while.
Now I need to make some changes but I get the "403 HTTP error fetching plugin" described here
The description in the docs makes sense: I have bought a new Apple M1 laptop since last time I worked on it, my stack was built with the digitalocean provider v3.1.1 but I can't install that version on my new laptop.
The docs say that if you have access to an Intel system, set up your project there, update the providers and run pulumi up. The implication is that you can install both old and latest versions of the provider plugin, pulumi up will update the stack using the latest version. After that I should be able to manage the stack from my new laptop using the latest provider version.
I asked on Pulumi Slack about this and confirmed the above.
But it doesn't seem to work for me.
First I started a Docker container with --platform=linux/amd64 to emulate Intel. Inside that I checked out my project, installed pulumi and the old and new provider versions.
In my docker container pulumi plugin ls shows:
NAME KIND VERSION SIZE INSTALLED LAST USED
cloudflare resource 4.7.0 38 MB n/a 1 day ago
cloudflare resource 2.8.0 46 MB n/a 1 day ago
digitalocean resource 4.14.0 42 MB n/a 1 day ago
digitalocean resource 3.1.1 45 MB n/a 1 day ago
From there I successfully ran pulumi up.
However if I go back to my local shell and try pulumi preview I get:
error: could not load plugin for digitalocean provider 'urn:pulumi:staging::myproject::pulumi:providers:digitalocean::default': no resource plugin 'pulumi-resource-digitalocean' found in the workspace at version v3.1.1 or on your $PATH, install the plugin using pulumi plugin install resource digitalocean v3.1.1
So despite updating the stack Pulumi is still trying to use the old provider version that I can't install.
How do I get around this?
You also need to update your pulumi program's dependencies.
Simply installing the new plugin isn't enough.
If you do pulumi stack export you'll see a JSON file with all your resources. Those resources have a provider attached to them with a specific version of the plugin. As an example:
{
"version": 3,
"deployment": {
"manifest": {
"time": "2022-06-23T12:03:30.071863-07:00",
"magic": "eccb7d9cc1cab43d7465783c52b0648063d5e7228dd3bb2fc7600583a8bca5d5",
"version": "v3.34.1"
},
"secrets_providers": {
"type": "service",
"state": {
"url": "https://api.pulumi.com",
"owner": "jaxxstorm",
"project": "s3_event_bridge",
"stack": "dev"
}
},
"resources": [
{
"urn": "urn:pulumi:dev::s3_event_bridge::pulumi:pulumi:Stack::s3_event_bridge-dev",
"custom": false,
"type": "pulumi:pulumi:Stack",
"outputs": {
"bucketName": "test001-c86ab36"
},
"sequenceNumber": 1
},
{
"urn": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1",
"custom": true,
"id": "484b75ed-d5cd-4ee1-96d1-b3f641236ab6",
"type": "pulumi:providers:aws",
"inputs": {
"region": "us-west-2",
"version": "5.9.1"
},
"outputs": {
"region": "us-west-2",
"version": "5.9.1"
},
"sequenceNumber": 1
},
{
"urn": "urn:pulumi:dev::s3_event_bridge::aws:s3/bucket:Bucket::test001",
"custom": true,
"id": "test001-c86ab36",
"type": "aws:s3/bucket:Bucket",
"inputs": {
"__defaults": [
"bucket",
"forceDestroy"
],
"acl": "private",
"bucket": "test001-c86ab36",
"forceDestroy": false,
"tags": {
"Environment": "Dev",
"Name": "My bucket",
"__defaults": []
}
},
"outputs": {
"accelerationStatus": "",
"acl": "private",
"arn": "arn:aws:s3:::test001-c86ab36",
"bucket": "test001-c86ab36",
"bucketDomainName": "test001-c86ab36.s3.amazonaws.com",
"bucketRegionalDomainName": "test001-c86ab36.s3.us-west-2.amazonaws.com",
"corsRules": [],
"forceDestroy": false,
"grants": [],
"hostedZoneId": "Z3BJ6K6RIION7M",
"id": "test001-c86ab36",
"lifecycleRules": [],
"loggings": [],
"objectLockConfiguration": null,
"region": "us-west-2",
"replicationConfiguration": null,
"requestPayer": "BucketOwner",
"serverSideEncryptionConfiguration": null,
"tags": {
"Environment": "Dev",
"Name": "My bucket"
},
"tagsAll": {
"Environment": "Dev",
"Name": "My bucket"
},
"versioning": {
"enabled": false,
"mfaDelete": false
},
"website": null
},
"parent": "urn:pulumi:dev::s3_event_bridge::pulumi:pulumi:Stack::s3_event_bridge-dev",
"provider": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1::484b75ed-d5cd-4ee1-96d1-b3f641236ab6",
"propertyDependencies": {
"acl": null,
"tags": null
},
"sequenceNumber": 1
},
{
"urn": "urn:pulumi:dev::s3_event_bridge::aws:s3/bucketNotification:BucketNotification::bucketNotification",
"custom": true,
"id": "test001-c86ab36",
"type": "aws:s3/bucketNotification:BucketNotification",
"inputs": {
"__defaults": [],
"bucket": "test001-c86ab36",
"eventbridge": false
},
"outputs": {
"bucket": "test001-c86ab36",
"eventbridge": false,
"id": "test001-c86ab36",
"lambdaFunctions": [],
"queues": [],
"topics": []
},
"parent": "urn:pulumi:dev::s3_event_bridge::pulumi:pulumi:Stack::s3_event_bridge-dev",
"dependencies": [
"urn:pulumi:dev::s3_event_bridge::aws:s3/bucket:Bucket::test001"
],
"provider": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1::484b75ed-d5cd-4ee1-96d1-b3f641236ab6",
"propertyDependencies": {
"bucket": [
"urn:pulumi:dev::s3_event_bridge::aws:s3/bucket:Bucket::test001"
],
"eventbridge": null
},
"sequenceNumber": 1
}
]
}
}
If you look at my BucketNotification resource, you can see a provider field which has a version in it for the AWS provider I've used:
"provider": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1::484b75ed-d5cd-4ee1-96d1-b3f641236ab6"
Which in this case is 5.9.1
So, in order to fix this problem, you need to update your resources to have a new version of the provider.
To do this, it depends on the language you're using with Pulumi.
If you're using TypeScript or JavaScript, update your #pulumi/digitalocean dependency in your package.json
If you're using Python, update pulumi_digitalocean in your requirements.txt
Make sure you update with your package manager with npm update or pip3 upgrade
The same applies if you're using DotNet, Go and Java.
then you need to run a successful pulumi up. Pulumi will update the provider version associated with each resource as you saw above, you can verify this by again doing a pulumi stack export
From here, you should be able to successfully use your M1 mac without the legacy plugins.

Mopa Bootstrap bundle failing to install

I get this error while trying to install the Mopa bootstrap bundle through command line:
"C:\ProgramData\ComposerSetup\bin\composer.bat" require
mopa/bootstrap-bundle ^3.0
Error:
installation failed reverting ./composer.json to its original content
mopa
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress]
[--no-suggest] [--no-update] [--no-scripts] [--update-no-dev]
[--update-with-dependencies] [--ignore-platform-reqs]
[--prefer-stable] [--prefer-lowest] [--sort-packages]
[-o|--optimize-autoloader] [-a|--classmap-authoritative]
[--apcu-autoloader] [--] []...
Im lost since I`m not getting any explanation of what failed.
So listen here, I have a solution for you. As I see that you are working with composer I'll teach you how to do it.
First you must change your "composer.json" file in your project, adding in "require" section:
"require": {
...
"mopa/bootstrap-bundle": "*",
"twbs/bootstrap": "*",
"knplabs/knp-menu-bundle": "*"
}
(NOTE: "knplabs/knp-menu-bundle": "*" is recommended to put as well when you use twbs).
And then add this repository in the json:
"repositories": [
{
"type": "package",
"package": {
"version": "2.2.1",
"name": "twitter/bootstrap",
"source": {
"url": "https://github.com/twitter/bootstrap.git",
"type": "git",
"reference": "master"
},
"dist": {
"url": "https://github.com/twitter/bootstrap/zipball/master",
"type": "zip"
}
}
}
]
Save and finally, you should execute your composer update(dev) command.
Hope it works!

Could not find package * at any version for your minimum-stability (stable). Check the package spelling or your min imum-stability

I have pushed my project to this address:
https://github.com/mojtabagithub/jdf-library.
But when I run this:
composer require rayvarzshiraz/jdf .
which is it's command to require, I get this error:
Could not find package rayvarzshiraz/jdf at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability.
This is my composer.json file :
{
"name": "rayvarzshiraz/jdf",
"minimum-stability": "stable",
"description": "A module for jdf persian calender library",
"keywords": [
"jdf",
"persian",
"calender",
"symfony"
],
"type": "library",
"authors": [
{
"name": "Mojtaba Dehdari",
"email": "mojtabadehdari#gmail.com",
"homepage": "http://jdf.scr.ir/"
}
],
"support": {
"email": "mojtabadehdari#gmail.com"
},
"require": {
},
"autoload": {
"files": ["lib/autoload.php"]
}
}
You must create a release in your GitHub repository.
For it, create a tag:
git tag -tag_name-
Then send the tag:
git push origin master -tag_name-
or
Go to your github repository and click in "releases" (this link https://github.com/mojtabagithub/jdf-library/releases) and follow the instructions.
Finally, update the packlist.org package

How can I update Lumen via composer?

I'm developping a web app using Lumen. I followed the instructions from the doc, installing laravel/lumen-installer via Composer, then doing lumen new myApp to get it properly installed (it was in April 2015).
While working on queues, the method "onQueue" was (and still is) not found... I presume I have an old version of the package "Illuminate/queue" (or what else?). Checking on packagist, Lumen is now in v5.1.5 (https://packagist.org/packages/laravel/lumen-framework) and the one I'm using is v5.0.4. So I did an update with composer :
composer update laravel/lumen-framework
But I get the v5.0.10, not the 5.1.4. Why so?
I checked that issue: https://github.com/dingo/api/issues/447 but in my composer.json, I have:
"config": {
"preferred-install": "dist"
}
So what is the problem? How can I get the last version of Lumen? Moreover, how can I get the onQueue method (updating only the package "Illuminate/queue")?
Thanks in advance
UPDATE, as asked in comments below, this is my initial composer.json (just not to miss anything):
{
"require": {
"laravel/lumen-installer": "~1.0"
}
}
and myApp composer.json:
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"laravel/lumen-framework": "5.0.*",
"vlucas/phpdotenv": "~1.0",
"illuminate/mail": "~5.0",
"imagine/imagine": "^0.6.2",
"league/csv": "^7.1",
"gregwar/captcha": "^1.1",
"neitanod/forceutf8": "^1.4",
"predis/predis": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"config": {
"preferred-install": "dist"
}
}
You have to update your composer.json
"require": {
"php": ">=5.5.9",
"laravel/lumen-framework": "5.1.*",
"vlucas/phpdotenv": "~1.0"
},

Composer create-project always fails with the project I created

I have this project on Github and Packagist:
https://github.com/gitraffa/framework
https://packagist.org/packages/gitraffa/framework
I want to use this as a deploy app, so, when I need to start a new project I just go to the cmd and type composer create-project gitraffa/framework --prefer-distand it should automatically create the folder and inser the files. But it isn't working(I always get something saying that a stable version could not be found). Am I doing something wrong or can't this be done?
Here is my composer.json file:
{
"name": "gitraffa/framework",
"description": "A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!",
"homepage": "http://rafaelmsantos.com/",
"license": "GPL-3.0",
"authors": [
{
"name": "Rafael Santos",
"email": "dev.rafael#mail.com",
"homepage": "http://rafaelmsantos.com"
}
],
"require": {
"php": ">=5.3.6",
"psr/log": "~1.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/gitraffa/framework"
}
],
"extra": {
"branch-alias": {
"dev-master": "1.0.0"
}
}
}
Composer by default installs only tagged versions (last stable that meets condition).
The error message can be fixed by:
using #dev tag, like: composer create-project gitraffa/framework:#dev --prefer-dist
tagging your package