'laminas-migration migrate -> "command not found" (ubuntu 20.04)

I am trying to migrate a ZF3 app to laminas. I have installed composer via apt, and added its vendor/bin to the PATH environment variable, for global usage:

$ composer -V
Composer version 2.2.4 2022-01-08 12:30:42

$ composer global config home
Changed current directory to /home/me/.config/composer
/home/me/.config/composer

$ export PATH={/home/me/.config/composer}:$PATH

Then globally installed laminas/laminas-migrate. Running it gets a "command not found" error:

$ composer global require laminas/laminas-migration
(output snip)
$ cd /var/www/my-project
/var/www/my-project $ laminas-migration migrate
laminas-migration: command not found

Output of PATH section from printenv:

PATH=/home/me/.yarn/bin:/home/me/.config/yarn/global/node_modules/.bin:/home/me/.yarn/bin:/home/me/.config/yarn/global/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin



Solution 1:[1]

Bob Allen did a great job describing once how to install composer libraries globally. I don't know if this still applies after all these years, but worth a try. For what I have seen in your description, I think you migh have lost the very important bit of extending your PATH with folder, that contains executables:

export PATH=~/.composer/vendor/bin:$PATH

This line added to yours user account .bash_profile file will add ~/.composer/vendor/bin/ to the binarries collection that is scanned in case of executing a command.

Solution 2:[2]

Do this instead.

export PATH=/home/me/.config/composer/vendor/bin:$PATH

Then close and reopen your terminal

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yergo
Solution 2 ramonthegreat