Composable algorithmic transformations in PHP