PHP code example of teckfuture / laravel-p6-analyzer
1. Go to this page and download the library: Download teckfuture/laravel-p6-analyzer 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/ */
teckfuture / laravel-p6-analyzer example snippets
use TeckFuture\P6Analyzer\Facades\P6Analyzer;
// Load and analyze
$report = P6Analyzer::load('/path/to/schedule.xer')->report('2024-01-15');
// Critical path only
$cpm = P6Analyzer::load('/path/to/schedule.xer')->criticalPath();
// DCMA 14-point check
$dcma = P6Analyzer::load('/path/to/schedule.xer')->dcma14Point('2024-01-15');
use TeckFuture\P6Analyzer\P6AnalyzerManager;
$analyzer = new P6AnalyzerManager();
$analyzer->load('/path/to/schedule.xer');
$health = $analyzer->scheduleHealth('2024-01-15');
$evm = $analyzer->earnedValue();
$float = $analyzer->floatAnalysis();
use TeckFuture\P6Analyzer\Enums\EvmMethod;
// Single method — auto-resolved or explicit
$evm = $analyzer->earnedValue('2024-01-15');
$evm = $analyzer->earnedValue('2024-01-15', EvmMethod::LaborUnits);
$evm['cpi']; // ?float — null when actual cost is unknowable
$evm['method']; // which basis actually ran, e.g. 'cost'
$evm['coverage']; // how many measurable activities carried data; coverage_pct is 0–100
$evm['actual_cost_sources']; // tracked vs inferred vs status-derived AC
// Every method in one pass (mirrors P6's By-Cost / By-Labor-Units pairs)
$all = $analyzer->earnedValueReport('2024-01-15');
$all['by_cost'];
$all['by_labor_units'];
$all['recommended'];