Where to find composer's global packages?

Where to find composer's global packages?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Where to find composer's global packages?

When installing a package globally via Composer, such as asm89/twig-lint for a Sublime Text plugin, the workflow often feels incomplete until you can actually execute the binary. The command composer global require "asm89/twig-lint" "@stable" successfully places files on your filesystem, but the subsequent step of configuring your environment is where most developers encounter friction. If the tool isn't working after adding paths to your editor configuration, it usually points to a mismatch between Composer's default installation directory and your system's actual layout.

Composer manages global dependencies by default in a hidden directory named .composer located within your home directory. On Windows systems, this typically translates to C:\Users\yourname\.composer\vendor\bin. However, relying on the assumption that this path exists is a common pitfall. If you run composer global require, Composer creates this directory structure automatically in your home folder. If the .composer directory is missing from your profile or PHP installation, it indicates that either the command failed silently, the home directory was not detected correctly by Composer, or the global vendor path was explicitly overridden during installation.

To locate the actual installation directory, you should inspect the bin-dir and config-dir settings within Composer's runtime configuration. You can retrieve the current paths directly from the command line using the following commands:

composer config bin-dir
composer config config-dir

These commands output the specific directories Composer is currently using for global binaries and configuration files. If the output points to C:\Users\yourname\.composer, then adding that exact string to your Sublime Text configuration file under the paths.windows key is the correct approach. If the output differs, or if you are unsure whether a home directory exists in your context, checking the environment variable COMPOSER_HOME provides further clarity. You can inspect this using:

echo %COMPOSER_HOME%

On many systems, especially those with limited disk space or specific containerized environments, COMPOSER_HOME might be set to a different location entirely. If this environment variable is defined, Composer will install global packages into that custom directory rather than the default .composer folder in your home directory. Ignoring this variable and looking for a non-existent .composer folder is the most likely reason your plugin fails to initialize.

Once you have confirmed the correct path via one of these methods, update your Sublime Text user configuration accordingly:

{
    "user": {
        "paths": {
            "windows": ["C:\\Users\\yourname\\.composer\\vendor\\bin"]
        }
    }
}

Replace the path with whatever composer config bin-dir returns. It is also worth noting that on some Windows configurations, particularly if you are using a specific terminal like PowerShell or WSL (Windows Subsystem for Linux), the home directory structure might differ. In WSL environments, the global vendor folder often resides at /var/www/.composer/vendor/bin or wherever your $HOME points within the Linux filesystem.

Another potential issue arises if vendor is not included in the path you are pointing to. While Composer installs binaries into the bin subfolder of the vendor directory, some tools might expect direct access to the vendor root or a different structure depending on how they are invoked. Ensure that the executable name matches exactly what was installed, including any version suffixes if applicable.

Finally, verify that your system's PATH environment variable includes the location returned by composer config bin-dir. Even if your editor adds the path for specific plugins, the underlying shell might not recognize the binary if it isn't globally exported. Running the which command (or where on Windows) against the executable name can confirm whether the system is actually finding the file:

where twig-lint

If this returns a valid path that matches your Composer configuration, but the plugin still fails, the issue may lie within the Sublime Text plugin's own initialization logic rather than the installation location. Always prioritize checking Composer's actual runtime configuration over assumed defaults to resolve these discrepancies efficiently.

Our network