PHP code example of aerendir / bin-github-actions-matrix

1. Go to this page and download the library: Download aerendir/bin-github-actions-matrix 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/ */

    

aerendir / bin-github-actions-matrix example snippets


   $config->addRequiredCheck('build ubuntu-latest');
   $config->addRequiredCheck('build windows-latest');
   

   
   
   $config = new Aerendir\Bin\GitHubActionsMatrix\Config\GHMatrixConfig();
   
   // Set the default GitHub username for the repository
   $config->setUser('your-github-username');
   
   // Set the default branch to sync/compare
   $config->setBranch('main');
   
   return $config;
   



// Committed config — keep it HOST-AGNOSTIC (no machine-specific absolute paths).
$config = new Aerendir\Bin\GitHubActionsMatrix\Config\GHMatrixConfig();

$config->setUser('your-org');
$config->setRepoName('your-repo');   // git remote isn't available inside the container
$config->setBranch('master');

// The project root is the current working directory (where the tool runs, e.g. backend/).
// From it the tool derives "./.github/workflows" (workflows location) and the token-file base — no host paths.
$config->setProjectDir('.');

// Token read from "<cwd>/gh_token" (git root isn't available in the container).
$config->setTokenFile('gh_token');

return $config;



$config = new Aerendir\Bin\GitHubActionsMatrix\Config\GHMatrixConfig();

// Set your default configuration
$config->setUser('your-github-username');
$config->setBranch('main');

// Mark specific combinations as optional (not .4']);

// Example 2: Test a specific combination of PHP and Symfony
$config->markOptionalCombination('phpunit', ['php' => '8.3', 'symfony' => '~8.0']);

// You can mark multiple combinations for the same workflow
$config->markOptionalCombination('integration-tests', ['php' => '8.4', 'database' => 'postgresql']);

return $config;

// This marks ALL combinations with PHP 8.4 as optional, regardless of other matrix values
$config->markOptionalCombination('phpunit', ['php' => '8.4']);

// If your matrix is:
// matrix:
//   php: ['8.3', '8.4']
//   symfony: ['~6.4', '~7.4']
//
// Then these combinations will be marked as optional:
// - phpunit (8.4, ~6.4)
// - phpunit (8.4, ~7.4)

$config->ignoreJob('deploy');

$config->addRequiredCheck('codecov');
bash
   cp gh-actions-matrix.dist.php gh-actions-matrix.php