Tuesday, January 4, 2022

[FIXED] Installing github package into Laravel project using composer

Issue

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?


Solution

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.

  1. 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

  2. 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.



Answered By - vsharper

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.