PHP code example of drupol / composer-packages

1. Go to this page and download the library: Download drupol/composer-packages 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/ */

    

drupol / composer-packages example snippets




declare(strict_types=1);

 Use your IDE auto completion to list all the available methods based on your installed packages.
$packages = Types::library();

foreach ($packages as $package) {
    $package->getName(); // $package is an instance of Composer\Package\PackageInterface
}

// You can also get an array
$packagesArray = iterator_to_array($packages);



declare(strict_types=1);

use Composer\Package\PackageInterface;

// Use your IDE auto completion to list all the available methods based on your installed packages.
$package = Packages::symfonyProcess();

// Package is an instance of Composer\Package\PackageInterface then:
$package->getName(); // To get the name.

// Find all the packages where the name starts with the letter "c".
$finder = static function (PackageInterface $package) : bool {
    return 'c' === str_split($package->getName())[0];
};

foreach (Packages::find($finder) as $package) {
    // Do something here.
}



declare(strict_types=1);

s;

// Use your IDE auto completion to list all the available methods based on your installed packages.
$directory = Directories::symfonyProcess();



declare(strict_types=1);


// Use your IDE auto completion to list all the available methods based on your installed packages.
$version = Versions::symfonyProcess();



declare(strict_types=1);

es;

// Use your IDE auto completion to list all the available methods based on your installed packages.
$dependencies = Dependencies::symfonyDependencyInjection();

foreach ($dependencies as $dependency) {
    echo $dependency; // $dependency is string, the package name.
}

// You can also get an array
$dependenciesArray = iterator_to_array($dependencies);



declare(strict_types=1);


// Use your IDE auto completion to list all the available methods based on your installed packages.
$version = Versions::symfonyProcess();