Last active
September 11, 2024 13:35
-
-
Save mfurlend/f5340de02fba166f9a84 to your computer and use it in GitHub Desktop.
composer require git repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my_vendor_name/my_package", | |
"description": "My Package Description", | |
"license": "GPL-3.0", | |
"autoload": { | |
"classmap": [ // search these directories for classes | |
"lib/" | |
] | |
}, | |
"repositories": { | |
"php-console-color": { // pseudonym of git repo | |
"type": "package", | |
"package": { | |
"name": "coryjthompson/php-console-color", // name of git repo | |
"version": "1.0", | |
"source": { | |
"url": "https://github.com/coryjthompson/php-console-color.git", // url to repo | |
"type": "git", // vcs or git | |
"reference": "origin/master" | |
} | |
} | |
} | |
}, | |
"require": { | |
"coryjthompson/php-console-color":"1.0" | |
} | |
} |
what should be the command for it?
I think composer update
would do the job
composer require coryjthompson/php-console-color
Thank you!
It doesn't work, can you explain me why?
"repositories": {
"wp-mvc": {
"type": "package",
"package": {
"name": "tombenner/wp-mvc",
"version": "1.5",
"source": {
"url": "https://github.com/tombenner/wp-mvc.git",
"type": "git",
"reference": "origin/master"
}
}
}
},
"require": {
"tombenner/wp-mvc": "1.5"
},
use this
"repositories": {
{
"type": "package",
"package": {
"name": "tombenner/wp-mvc",
"version": "1.5",
"source": {
"url": "https://github.com/tombenner/wp-mvc.git",
"type": "git",
"reference": "origin/master"
}
}
},
}
"require": {
"tombenner/wp-mvc": "1.5"
},
@richardkeep
If your intention was to say:
"repositories": [
{
"type": "package",
"package": {
"name": "tombenner/wp-mvc",
"version": "1.5",
"source": {
"url": "https://github.com/tombenner/wp-mvc.git",
"type": "git",
"reference": "origin/master"
}
}
}
],
"require": {
"php": ">=5.4",
"tombenner/wp-mvc": "1.5"
},
It doesn't work as well.
@celorodovalho try this:
"repositories": [
{
"type": "git",
"url": "https://github.com/tombenner/wp-mvc.git"
}
],
"require":{
"tombenner/wp-mvc": "dev-master"
}
@adityastic I tried it already, I try with all possible ways.
The only way that I could make it work is like that:
{
"type": "package",
"package": {
"name": "wp-plugins/wp-mvc",
"version": "1",
"type": "wordpress-plugin",
"source": {
"url": "https://github.com/tombenner/wp-mvc.git",
"type": "git",
"reference": "master"
}
}
}
"require": {
"wp-plugins/wp-mvc": "^1"
}
I really don't know why, it should work as you suggested.
In case you forked the repo it works like this way
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
},
{
"type": "vcs",
"url": "https://github.com/grandeto/faker",
"no-api": true
}
],
"require": {
"fzaninotto/faker": "dev-master"
}
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what should be the command for it?