Versatile lightweight package to detect a composers' root path.

0.1.1 2016-01-31 12:03 UTC

This package is auto-updated.

Last update: 2020-07-06 00:02:50 UTC


A composer plugin to provide an API to access the Composer's root path and thus, access to composer.json

What does it do?

The plugin adds a constant BMACK_PROJECTROOT which contains the path to the root path of the project installed via composer.

An API class is used for accessing the constant, and is actually there so it can be enriched in your own application.


In the TYPO3 project, we want to work with the composer.json file to detect certain special parameters. However, this is not possible to detect from the vendor directory during runtime of your PHP application where your project root directory is.


Just require the package to your composer project:

composer require bmack/composer-projectcontext


You have then the constant BMACK_PROJECTROOT in your project when including the autoload file


MIT. Free for everyone, you can even make money off of it.


Benni Mack starting in 2016.