Documentation

Composer
in package

Class Composer.

An helper class to read data from composer.json et composer.lock files.

Tags
author

MacFJA

license

MIT

Table of Contents

Properties

$composerJsonPath  : string
The path to the `composer.json` file
$lockContentCache  : array<string|int, mixed>
Instance cache for the `composer.lock` file

Methods

__construct()  : mixed
Constructor of the helper class.
getComposerConfig()  : array<string|int, mixed>
Get the phar-builder config data from the composer.json
getComposerJsonPath()  : string
Get the path to the `composer.json` file.
getDevOnlyPackageName()  : array<string|int, mixed>
Get the list of package name that are only use in require-dev
getRemoveFilesAutoloadFor()  : string|null
Remove packages files from the **files** autoloader
getSourcePaths()  : array<string|int, mixed>
Get all paths (files and directories) of root package sources.
getStubFiles()  : array<string|int, mixed>
Get all files required by require-dev that have to be stubbed.
getVendorDir()  : string
Get the vendor directory name.
getLockFileContent()  : array<string|int, mixed>
Get the JSON (array) content of the `composer.lock` file
readAutoload()  : array<string|int, mixed>
Read the JSON node (associative array). The node is the content of a autoload(-dev) entry.

Properties

$composerJsonPath

The path to the `composer.json` file

protected string $composerJsonPath

$lockContentCache

Instance cache for the `composer.lock` file

private array<string|int, mixed> $lockContentCache

Methods

__construct()

Constructor of the helper class.

public __construct(string $composerFile) : mixed
Parameters
$composerFile : string

The path to the composer.json file

getComposerConfig()

Get the phar-builder config data from the composer.json

public getComposerConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

getComposerJsonPath()

Get the path to the `composer.json` file.

public getComposerJsonPath() : string
Return values
string

getDevOnlyPackageName()

Get the list of package name that are only use in require-dev

public getDevOnlyPackageName() : array<string|int, mixed>
Tags
throws
RuntimeException
Return values
array<string|int, mixed>

getRemoveFilesAutoloadFor()

Remove packages files from the **files** autoloader

public getRemoveFilesAutoloadFor(array<string|int, string> $packageNames) : string|null
Parameters
$packageNames : array<string|int, string>

List of the packages name

Tags
throws
RuntimeException
Return values
string|null

getSourcePaths()

Get all paths (files and directories) of root package sources.

public getSourcePaths([bool $includeDev = false ]) : array<string|int, mixed>
Parameters
$includeDev : bool = false

Indicate if the dev files must be added.

Tags
SuppressWarnings

(PHPMD.BooleanArgumentFlag)

Return values
array<string|int, mixed>

getStubFiles()

Get all files required by require-dev that have to be stubbed.

public getStubFiles([bool $includeDev = false ]) : array<string|int, mixed>
Parameters
$includeDev : bool = false

Indicate if the dev files must be added.

Tags
SuppressWarnings

(PHPMD.BooleanArgumentFlag)

Return values
array<string|int, mixed>

getVendorDir()

Get the vendor directory name.

public getVendorDir() : string

By default it's vendor but it can be changed in composer.json file.

Return values
string

getLockFileContent()

Get the JSON (array) content of the `composer.lock` file

protected getLockFileContent() : array<string|int, mixed>
Tags
throws
RuntimeException
Return values
array<string|int, mixed>

readAutoload()

Read the JSON node (associative array). The node is the content of a autoload(-dev) entry.

protected readAutoload(array<string|int, mixed> $jsonNode) : array<string|int, mixed>
Parameters
$jsonNode : array<string|int, mixed>

The autoload(-dev) entry

Return values
array<string|int, mixed>

        
On this page

Search results