How to use Github private Composer package as a local package for Laravel using Composer

How to use private Composer package as a local package
Post:
Robin
Category:

To use your Github private composer package as your local package you need to download it from github

git clone
clone github repository

or you can clone it using this command

git clone <repository url>

if you are trying to use xgenoius private package as local repository then you will get the file in

“@core/vendor/xgenious/packagename”

xgenious laravel private package
xgenious private laravel package path

you might found only core in our latest project, in older project we used @core

Now make a folder inside @core or core folder name it as packages and copy package file here

copy package file to folder
copy package file to a folder

if you download from github, you might found tags with the package folder name , rename it with only package name.

go to @core or core > composer.json file open it and remove the vcs package code

load package from github
load package from github

add below code to point the local package we copied in your packages folder

add composer code for load local package
add composer code for load local package

if you are using our xgneious script , you need to remove the our private packages first to load it from locally

composer remove xgenious/paymentgateway then need to change composer.json code to point to local package

image 9

if you see any it asking for token, hit enter for abort. then follow below part for user it as local package

 "repositories": [
        {
            "type": "path",
            "url": "packages/paymentgateway"
        }
    ],
  "require": {
        "php": "^8.0.2",
        "xgenious/paymentgateway": "dev-master"
    },

now run composer require command the package

composer require xgenious/paymentgateway

that’s all now it should work fine with your composer local package, you can us any other package with the script now./

Let’s Build Together