Easily parse your project's Composer configuration, and those of its dependencies, at runtime

Last update: Apr 11, 2021

Composed

Code Quality

This library provides a set of utility functions designed to help you parse your project's Composer configuration, and those of its dependencies, at runtime.

Usage

The API combines functional and object-oriented approaches.

Locate the vendor directory

(Chicken and egg...)

$absoluteVendorPath = Composed\VENDOR_DIR;

Locate the project's base directory

$absoluteProjectPath = Composed\BASE_DIR;

Get the authors of a specific package

You can fetch data from the composer.json file of a specific package.

$authors = Composed\package_config('phpunit/phpunit', 'authors');

assert($authors === [
    [
        'name' => "Sebastian Bergmann",
        'email' => "[email protected]",
        'role' => "lead",
    ],
]);

Get licenses of all installed packages

You can fetch data from all composer.json files in your project in one go.

$licenses = Composed\package_configs('license');

assert($licenses === [
  'joshdifabio/composed' => "MIT",
  'doctrine/instantiator' => "MIT",
  'phpunit/php-code-coverage' => "BSD-3-Clause",
]);

Get the absolute path to a file in a package

$path = Composed\package('phpunit/phpunit')->getPath('composer.json');

Get all packages installed on your project

foreach (Composed\packages() as $packageName => $package) {
    $pathToPackageConfig = $package->getPath('composer.json');
    // ...
}

Get data from your project's Composer config

You can also fetch data from the composer.json file located in your project root.

$projectAuthors = Composed\project_config('authors');

assert($projectAuthors === [
    [
        'name' => 'Josh Di Fabio',
        'email' => '[email protected]',
    ],
]);

Installation

Install Composed using composer.

composer require joshdifabio/composed

Credits

Credit goes to @igorw whose get-in library is partially copied into this library. Unfortunately, igorw/get-in requires PHP 5.4 while Composed aims for PHP 5.3 compatibility.

License

Composed is released under the MIT license.

GitHub

https://github.com/joshdifabio/composed
You might also like...

Staggered import of large and very large MySQL Dumps even through the web servers with hard runtime limit and those in safe mode.

Staggered import of large and very large MySQL Dumps (like phpMyAdmin dumps) even through the web servers with hard runtime limit and those in safe mode. | Persian Translation Version

Jan 8, 2022

Merge one or more additional composer.json files at Composer runtime

Composer Merge Plugin Merge multiple composer.json files at Composer runtime. Composer Merge Plugin is intended to allow easier dependency management

May 16, 2022

A Composer tool to show unused Composer dependencies by scanning your code.

A Composer tool to show unused Composer dependencies by scanning your code.

composer-unused A Composer tool to show unused Composer dependencies by scanning your code. Created by Andreas Frömer and contributors, logo by Caneco

May 20, 2022

Developers tool for WordPress plugins: Wraps all your projects dependencies in your own namespace

Developers tool for WordPress plugins: Wraps all your projects dependencies in your own namespace, in order to prevent conflicts with other plugins loading the same dependencies in different versions.

May 20, 2022

These projects are free for public use. Be a lesson for those who violate the rights of others!! ✌️

Faraz Kish Projects These projects are free for public use. Be a lesson for those who violate the rights of others!! ✌️ Brands Farazkish Uinvest MFina

May 20, 2022

:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects

sabre/vobject The VObject library allows you to easily parse and manipulate iCalendar and vCard objects using PHP. The goal of the VObject library is

May 15, 2022

A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

composer-custom-directory-installer A composer plugin, to install differenty types of composer packages in custom directories outside the default comp

Apr 22, 2022

Simplexcel.php - Easily read / parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc spreadsheet tabular file formats

Simple Excel Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats For further deatails see the GitHuib P

May 19, 2022

Composer registry manager that help to easily switch to the composer repository you want

CRM - Composer Registry Manager Composer Registry Manager can help you easily and quickly switch between different composer repositories. 简体中文 Install

May 18, 2022

Shade/Inject composer dependencies into PocketMine-MP plugins.

ComposerShader README for v0.2.0-dev Important Note: This is not perfect, nor will it ever be, with several checks for common uses of certain function

Aug 5, 2021

Detect unused composer dependencies

Detect unused composer dependencies

Project scanner for detect unused composer dependencies Versions Use [email protected] versions for projects with php 5.6, 7.0 Use 2.x versions for projects w

May 14, 2022

This composer plugin is a temporary implementation of using symbolic links to local packages as dependencies to allow a parallel work process

Composer symlinker A Composer plugin to install packages as local symbolic links. This plugin is a temporary implementation of using symbolic links to

Nov 9, 2021

This composer plugin allows you to share your selected packages between your projects by creating symlinks

This composer plugin allows you to share your selected packages between your projects by creating symlinks

Composer - Shared Package Plugin This composer plugin allows you to share your selected packages between your projects by creating symlinks. All share

Dec 14, 2021

PeachPie - the PHP compiler and runtime for .NET and .NET Core

PeachPie - the PHP compiler and runtime for .NET and .NET Core

PeachPie Compiler The open-source PHP compiler to .NET If you run into any inconsistencies, bugs or incompatibilities, kindly let us know and we'll do

May 19, 2022

☕ Latte: the intuitive and fast template engine for those who want the most secure PHP sites.

Latte: amazing template engine for PHP Introduction Latte is a template engine for PHP which eases your work and ensures the output is protected again

May 22, 2022

A PHP library to deal with all those media services around, parsing their URLs and displaying their audios/videos.

MediaEmbed A utility library that generates HTML embed tags for audio or video located on a given URL. It also parses and validates given media URLs.

Jan 12, 2022

Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number of items.

Adds a compact

Repeater Easy Sort Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number o

Oct 10, 2021

GitHub action to setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer...

GitHub action to setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer...

Setup PHP in GitHub Actions Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in GitHub

May 21, 2022
Merge one or more additional composer.json files at Composer runtime

Composer Merge Plugin Merge multiple composer.json files at Composer runtime. Composer Merge Plugin is intended to allow easier dependency management

May 16, 2022
Simple static Composer repository generator - For a full private Composer repo use Private Packagist

Satis Simple static Composer repository generator. Run from source Satis requires a recent PHP version, it does not run with unsupported PHP versions.

May 25, 2022
:musical_note: Provides a composer plugin for normalizing composer.json.
:musical_note: Provides a composer plugin for normalizing composer.json.

composer-normalize Provides a composer plugin for normalizing composer.json. Why When it comes to formatting composer.json, you have the following opt

May 28, 2022
Simple composer script to manage phar files using project composer.json.
Simple composer script to manage phar files using project composer.json.

tooly-composer-script With tooly composer-script you can version needed PHAR files in your project's composer.json without adding them directly to a V

Aug 3, 2021
Satis-go is a web server for hosting and managing your Satis Repository for Composer Packages

Satis-go download latest Satis-go is a web server for hosting and managing your Satis Repository for Composer Packages Some Highlights: Satis-go provi

Dec 14, 2021
composer parallel install plugin
composer parallel install plugin

prestissimo (composer plugin) This is a composer 1.x plugin that downloads packages in parallel to speed up the installation process. Announcement: Co

May 20, 2022
Patch other composer packages on install or update

patch-installer Patch other composer packages on install or update. experimental feature Usage For a patch type change the install path to vendor dire

Apr 11, 2021
A no-frills PsySH-Composer plugin
A no-frills PsySH-Composer plugin

uma/composer-psysh A no-frills PsySH-Composer plugin. In a nutshell, it provides a composer psy subcommand that spawns a Psy Shell with autoload integ

May 23, 2022
A CLI tool to check whether a specific composer package uses imported symbols that aren't part of its direct composer dependencies

A CLI tool to analyze composer dependencies and verify that no unknown symbols are used in the sources of a package. This will prevent you from using "soft" dependencies that are not defined within your composer.json require section.

May 17, 2022
Check your Composer dependencies at runtime.

Composition Composition provides a lightweight and generic API, that you can use to check your environment at runtime, instead of manually go checking

May 4, 2021