Skip to content
Advertisement

Update project created with composer create-project

There are some frameworks like laravel which recommend installation using create-project. It would be hard to update projects like this through composer, because

The composer create-project creates the skeleton with all initial routes in your configuration etc.

From the very very first moment you are starting to change the default routes, removing the default controllers and changing the default views, your project would be out of sync. because meanwhile laravel changes the skeleton to newer versions with some new default routes etc or event changes directory structure.

However, I’ve recently seen that phpmyadmin recommends composer create-project as a possible installation method.

As phpmyadmin does not simply provide some skeleton files to be modified by the user, but a complete, finished web-app, I’d like to know what’s the best way to update a phpmyadmin installation created like that?

Advertisement

Answer

I don’t know whether there is an official way to do this.

According to the docs, create-project is the equivalent of:

doing a git clone/svn checkout followed by a composer install of the vendors.

If you haven’t modified any of the files, I think the easiest way would be to just delete the directory and run composer create-project again.

If you have modified some of the files, you could do a git merge (if the project uses git) and run composer update again.

If you haven’t yet created the project, you could run create-project with the --keep-vcs flag and then every time you want to update it, you can cd to the project and run:

git pull origin <version>
composer update

If you have already installed the project without --keep-vcs, then you’ll have to make the directory a git repository and then add the project’s repository as remote. To find the project’s repository, search for it on Packagist. For example, for phpmyadmin:

cd phpmyadmin
git init
git add .
git commit -m "Add initial files"
git remote add git@github.com:phpmyadmin/composer.git
git pull origin <version> --allow-unrelated-histories -Xtheirs 
composer update

Some of your changes might be lost with the above git pull though so make a backup (and maybe research other ways to merge unrelated histories).

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement