PHP code example of mcstreetguy / composer-parser

1. Go to this page and download the library: Download mcstreetguy/composer-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mcstreetguy / composer-parser example snippets

 php
$composerJson = ComposerParser::parseComposerJson('/some/file');
$lockfile = ComposerParser::parseLockfile('/another/file');
 php
use \MCStreetguy\ComposerParse\ComposerJson;

$rawData = file_get_contents('/path/to/composer.json');
$parsedData = json_decode($rawData, true);

$composerJson = new ComposerJson($parsedData);
 php
use \MCStreetguy\ComposerParse\Json\Author;

$rawData = file_get_contents('/path/to/composer.json');
$parsedData = json_decode($rawData, true);

$author = new Author($parsedData['authors'][0]);
 php
$license = $composerJson->getLicense();
$version = $composerJson->getVersion();
 php
$description = $composerJson->description;
$
 php
if ($composerJson->config->isEmpty()) {
    // Do something
}
 php
$oBar = $equire as $ment['package'];
    $version = $
 php
$map = $
 php
$psr4 = [
    [
        "namespace" => "MCStreetguy\\ComposerParser\\",
        "source" => "src/"
    ]
]