endurance / workout
Immutable workout prescriptions with typed targets and bounded repeat occurrence reads
v0.2.0
2026-11-23 20:28 UTC
Requires
- php: ^8.5
- endurance/foundation: ^0.2.0
Requires (Dev)
- phpunit/phpunit: ^12.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-23 20:31:30 UTC
README
Immutable workout prescriptions, bounded repeat traversal and versioned plans for PHP 8.5.
composer require endurance/workout
use Endurance\Workout\{Repeat, Sequence, Step, StepPurpose, Workout}; use Endurance\Workout\Duration\TimeDuration; $work = new Step(new TimeDuration(120_000_000)); $recovery = new Step(new TimeDuration(60_000_000), purpose: StepPurpose::Recovery); $workout = new Workout(new Sequence(new Repeat(3, new Sequence($work, $recovery)))); $fifth = $workout->steps->stepAt(5);
- Time durations use integer microseconds; distance durations use metres.
OpenDurationmeans explicit manual completion, not an unknown duration. Relative targets retain their declared baseline without selecting athlete data. - Occurrences are one-based within the exact prescription.
stepAt()and boundedoccurrences(after:, limit:)skip repeat subtrees without expanding them. PublishWorkouttakes caller-generated plan/revision IDs, a clock and aWorkoutRepository. Replacement checks both expected head fields atomically; historical content and revision IDs remain immutable.- Storage is unscoped; authorize access in your application. Reconcile uncertain writes by durable identity before retrying.
License: MPL-2.0.