I need to install custom packages from github url using composer. My Laravel 5.2 based project is clean and fresh install.
The github project I need is: https://github.com/cmcdonaldca/ohShopify.php
I am still new to Laravel and composer and need help with clear steps as much as possible.
Any help?
I am going to use this repo to explain the steps. The reasons is because the repo you includes do not have composer.json
which I don't think possible to install using composer in that case
Add repositories in composer.json
"repositories": [
{
"url": "https://github.com/notmaintained/shopify.php",
"type": "git"
}
],
Add the package name in require with the branch name after the dev
:
"sandeepshetty/shopify.php" : "dev-master"
EDIT:
Just tested this. There are some error since it was unmaintained package but you should get the idea of installing composer package using git.
An improvement to the answer above.
Add repositories in composer.json
"repositories": [
{
"url": "https://github.com/notmaintained/shopify.php",
"type": "git"
}
],
Add the package name in require with the branch name after the dev:
"sandeepshetty/shopify.php" : "dev-master"
The package name is sometimes mistaken with the username/repo name. Always open the composer.json file to get the actual packcage name. I spent great deal of time looking around.
Composer uses packages from the repository https://packagist.org/. You can't really just use github packages directly from github.
You have 2 options here.
Use a package available on https://packagist.org/ to integrate with the shopify API. I've had a look on packagist and found rocket-code/shopify and phpish/shopify. To add them to your laravel project, in the folder that contains the composer.json file use the following command:
composer require rocket-code/shopify
You could create your own packagist package using the git repository. so you'll clone the repo and then create your own packagist account. So sign up, get a packagist account, upload the file and then require it in your laravel project.
I suggest that you use an existing composer package, as it takes away the responsibility of managing your own package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With