teckfuture / laravel-p6-analyzer
A standalone Laravel package for parsing, analyzing, and exporting Primavera P6 XER schedule files.
Requires
- php: ^8.3
- illuminate/support: ^12.0|^13.0
- nesbot/carbon: ^3.8.4
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v3.0.0
- v2.4.2
- v2.4.1
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.0
- v1.2.0
- v1.1.0
- v1.0.0
- dev-chore/release-3.0.0
- dev-feat/v3-renames
- dev-fix/variance-and-summaries
- dev-fix/dcma-and-health
- dev-fix/io-hardening
- dev-fix/api-surface-docs
- dev-fix/over-allocation-per-resource-day
- dev-test/suite-hygiene
- dev-chore/packaging-ci-docs
- dev-chore/release-2.4.1
This package is auto-updated.
Last update: 2026-10-29 04:20:05 UTC
README
A standalone Laravel package for parsing, analyzing, and exporting Primavera P6 XER schedule files. Provides DCMA 14-point schedule assessments, critical path analysis, earned value calculations, resource utilization analysis, and much more — all from a fluent, developer-friendly API.
Features
- XER Parsing — Parse
.xerfiles or raw XER strings into a structuredParsedXerDataobject - DCMA 14-Point Check — Automated schedule quality assessment with configurable thresholds
- Critical Path Analysis — Identify critical activities based on total float
- Earned Value Management — Calculate PV, EV, AC, CPI, SPI, EAC
- Float Distribution — Analyze total float spread across the schedule
- Relationship Analysis — FS/SS/FF/SF type distribution and lag metrics
- Schedule Variance — Compare two schedules to detect slipping activities
- Schedule Health Check — Missing resources, missing logic, actual starts after the data date
- Resource Utilization — Per-resource loading with over-allocation detection
- WBS Analysis — Work breakdown structure metrics
- Lookahead Generation — Filtered x-week lookahead schedules
- Progress Summary — Overall schedule progress by status and duration
- Work Package Rollup — Summarize activities into WBS-based work packages
- Snapshot Comparison — Diff two XER files to detect added/deleted/modified activities
- XER Export — Write modified schedules back to XER format
- CSV Export — Export any parsed table to CSV
Requirements
- PHP 8.3 or newer
- Laravel 12 or 13
Installation
composer require teckfuture/laravel-p6-analyzer
Publish Configuration (Optional)
php artisan vendor:publish --tag=p6-analyzer-config
Quick Start
Using the Facade
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');
Using the Manager Directly
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();
Earned Value Management
EVM runs under an explicit measurement method — cost (resource-assignment
costs), labor_units (native TASK work quantities), or duration (a
last-resort proxy). Units are never mixed across activities; auto (the
default) picks the best-covered method per project and reports its choice.
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'];
Behavior toggles (config p6-analyzer.evm.* or the calculator's constructor):
inferring actuals from remaining amounts, honoring P6 complete_pct_type,
and status-driven percent overrides. See docs/analysis.md.
Querying Schedule Data
$analyzer = new P6AnalyzerManager(); $analyzer->load('/path/to/schedule.xer'); $query = $analyzer->query(); $projects = $query->listProjects(); $activity = $query->getActivity('A1000'); $results = $query->searchActivities('concrete');
Exporting
$xer = $analyzer->exportXer(); // XER string $csv = $analyzer->exportCsv('TASK'); // CSV string $analyzer->exportXerToFile('/path/to/output.xer'); // Write to file
Testing
./vendor/bin/pest
Documentation
Detailed documentation is available in the docs/ directory:
- Installation
- Configuration
- Parsing XER Files
- Querying Schedule Data
- Analysis & Calculators
- Report Generation
- Schedule Comparison
- Modifying Schedules
- Exporting Data
- Facade & Manager API
- Upgrading guide
Changelog
See CHANGELOG.md for what changed in each release.
Contributing
See CONTRIBUTING.md. Please report security issues privately as described in SECURITY.md.
License
MIT — see LICENSE.