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

Hawkydoky's avatar

vendor : how to go back to an old version of packages?

After a few changes in my code, I added/updated packages to my vendor and committed everything to a working branch through git, since then my new elements works, but some of my old stuff (that are way more important) doesn't works at all.

I'd like to come back to an old version of my code. I cloned my master branch in a new directory, my new elements are not there (normal) but old stuff doesn't works.

I don't know much about vendor nor Laravel so maybe I misunderstand something.

Is there a way to come back to a working version of my code and getting my old vendor package? Or maybe just an update of all the package could fix that?

I'm really talking about vendor, I got my old dev code through my master branch.

0 likes
10 replies
Cronix's avatar

You can set the version of the different packages in your composer.json file. Just set it/them to a specific version so it won't update it so you can lock it in and composer update

so instead of something like

"barryvdh/laravel-ide-helper": "^2.4",

you could

"barryvdh/laravel-ide-helper": "2.4",

and it will always stay at version 2.4.

If you commit your composer.lock file to git (always good to do), you should also be able to backtrack that and see what versions things were through time.

click's avatar

And as an addition to Cronix answer: to figure out what version you were using before:

  1. Find your previous composer.lock file in git
  2. Search for the package you want to revert, for example the laravel-ide-helper. And look at the version
{
            "name": "barryvdh/laravel-ide-helper",
            "version": "v2.4.3",
            "source": {
.... etc.
  1. And than do what Cronix already explained:
"barryvdh/laravel-ide-helper": "2.4.3",
Hawkydoky's avatar

Thanks guys for your answers. What I did was to download a full old project on my git (that was working), with the vendor. It still doesn't works. Since then, I don't really know what could be the issue(s).

The online version works, the one on my computer, using apache2, doesn't.

Right now, I'm not even sure that the problem comes from the vendor...

@Cronix @m-rk any idea what could happen ?

click's avatar

No we can't see that from here without any more information. What does not work? Errors?

Did you run composer install when you did a new checkout of your project?

Hawkydoky's avatar

What doesn't work: When I click on a button, it should send some information to a database, and then show the information just sent on the page. Right now it's going to the page but no informations are sent and nothing is shown on the page. I've no error at all.

I tried with the old vendor, not working, then I deleted the vendor, run composer install, still not working.

click's avatar

I doubt that is related to composer. It could also be a frontend issue. But it can be a thousand of reasons why this is not working anymore. Did you do any yarn install / update or npm install / update ?

Alternative approach: Go back to in your git history and figure out since when it ain't working anymore.

Hawkydoky's avatar

@m-rk I remember I did a npm install or update at a moment during my work yes. Could it be the issue? Some updated files that doesn't work with a previous version? Is there anything I can do about that?

I was working on a working branch and never merged it to the master branch. When I download the master's project and run it, it doesn't work.

That's what made me think maybe it's not the vendor but something else.

benjivm's avatar

Sounds like an environment issue. Is your .env setup and are all required PHP extensions loaded?

click's avatar

As I said, it can be a thousands of reasons. We can't see your code or screen from here. But yes if you run npm update it is going to update all of your javascript dependencies to the latest version. Equal to composer update. Depending on your setting in package.json it is going to update to a (major/minor/hotfix) version. Javascript libraries are not always using semver in a correct way so even a minor upgrade could break your code. I don't know if this is the case for you but it could be.

If you have a recent version of npm (or yarn) you should have a package-lock.json or yarn.lock file in the root directory. If so, you should be able to revert it back to the one that worked. Run again npm install and it should revert your frontend third party libraries. If you don't have such a lock file for npm packages... I don't know how/if you could revert this nicely.

But maybe the reason is something completely different. You need to give more detailed information if you want our help. Do you see errors somewhere? In your console? Are you using third party packages that are submitting your form? Ajax requests? Etc. etc. etc.

Hawkydoky's avatar

I had no error message until this morning. I tried to change my working branch and to get back to my master branch in PHPStorm. When doing this I got the error 'Couldn't checkout to master, unable to unlink old "vendor/barryvdh/laravel-cors/composer.json" ' I look into it and compared it to an old one and only one line change:

In my NEW one I have : "dev-master": "0.9-dev" In my OLD one I have: "dev-master": "0.10-dev"

Could it be my problem? Any way to solve that?

I submit my form doing:

<form method="POST" action="/home">
                {{ csrf_field() }}
                <div class="form-group">
                    <label for="formGroupExampleInput">
                        Destination
                    </label>
                    <input id="destination" name="destination" placeholder="Enter destination address here" class="form-control">
                </div>
                <div class="form-group">
                    <label for="formGroupExampleInput">
                        Destination Display Name
                    </label>
                    <input type="text" class="form-control" name="destination_pseudo" placeholder="Ex: Home, Gym, Airport">
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary" style="width:100%">Add Destination</button>
                </div>
            </form>

Sorry, I don't have much more information than the one you have here. Posting all my code wouldn't be a solution as it's a whole project.

Thanks.

Please or to participate in this conversation.