The php implementation for `binpack`.