See https://mvuorre.github.io/bmlm/ for a short tutorial.