Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

scottsuhy's avatar

Issue with 3rd party library setup

after 2 years of using Laravel and Forge, sometimes, I still feel like such a newbie... Sorry for such a generic question, but I'm not finding any answers googling the interdependencies of a local build, GitHub, and Forge/AWS..

Background:

I've been building an app using Laravel for the past couple weeks.

I needed to integrate with a 3rd party so I downloaded a GitHub PHP repository, "XYZ" that did some of the integration.

It required installation via "composer require XYZ"

Everything is put in the Laravel vendor directory.

I made quite a few additions/changes to the XYZ code to bring it up to date for my needs (I updated the code in the vendor directory)

I have been syncing the overall Laravel project via Visual Studio to a private GitHub repository

The Issue:

I just pushed the repository via Forge to AWS, and none of the code I changed in the 3rd party "XYZ" code is there.

so, I looked at GitHub and realized that there is no vendor directory hence the 3rd party XYZ library and my changes to it are not being pulled from GitHub to AWS (only my app code is there). I find that the vendor directory is in the gitignore file.

Questions: What is the right way to install this 3rd party library (and my changes) via Forge? Where did I go wrong? is there a way to update the gitignore file to allow this one XYZ library (with my changes) to be pushed to GitHub -> Forge -> AWS?

0 likes
3 replies
Dunsti's avatar

It is not a good idea, to change code in 3rd-party-package as you are not able to get updates or bugfixes to this package in the future.

A better solution is, to make a fork of the project and convert it to an own package on github.

More on Laravel package development can be found here: https://laravel.com/docs/9.x/packages

1 like
scottsuhy's avatar
scottsuhy
OP
Best Answer
Level 1

@Dunsti thank you for the pointer

Here is the package: https://github.com/skrilled/metrc-php/tree/master/src - it's outdated and I doubt it will ever be touched again.

It has several models, an exception script, and 2 source scripts that encapsulate a 3rd party REST API.

Per the package description on https://laravel.com/docs/9.x/packages it's standalone. There is nothing in config/app.php and it only shows up in the composer.json in the require section

{
    ...
    "require": {
        ...
        "alternatehealth/metrc": "9999999-dev",
        ....
    },

No one else will install the app i'm building (1 off project for a friend) so I'm wondering if the best way out of the quagmire I've created (works on localhost but not with GitHub/Forge/AWS) is:

  1. create my own fork as you pointed out that I should of did in the first place <<seems complicated and time-consuming given this is a 1 off but would be learning for me
  2. move the 3rd party models and code into my apps base Laravel project <<seems easy enough but not quite sure where the 2 source scripts that encapsulate the 3rd party REST API should live in the Laravel tree.
  3. try to add it as a provider in the config/app.php <<not sure if this is even feasible but when reading the link it sounded like it might work.

Suggestions?

scottsuhy's avatar

I used #1 and the following:

  1. Forked the repository into my own GitHub.
  2. Cloned the fork into a new separate local directory
  3. Copied the files I updated in the project/vendor/package directory to the newly cloned repository directory.
  4. Commited the changes and pushed to update the fork
  5. Went back and opened up the main project and fixed composer.json to list my fork of the package instead of the original package
  6. composer up --dry-run (should list 1 remove and 1 install)
  7. composer up
  8. git add, git commit, git push the main project
  9. Deployed on the Forge server
  10. Fixed

thanks for the help.

Please or to participate in this conversation.