A clifford algebra understanding of rotations/boosts in Minkowski space can help here.
Let $\gamma_0 \gamma_0 = -1$ and $\gamma_i \gamma_i = +1$ (no sum) for $i=1, 2$ or $3$. You might recognize this notation for gamma matrices from quantum mechanics, but the clifford algebra for Minkowski spacetime does not rely upon us writing out these matrices explicitly; their algebraic properties are good enough. For this reason, I won't call them matrices but basis vectors instead.
A product of the form $\gamma_i \gamma_j$ for $i,j \in \{1, 2, 3\}$ forms a spatial bivector. Exponentials of spatial bivectors, and their linear combinations, form the algebra of quaternions. Consider, for example, $\gamma_1 \gamma_2$ in an exponential:
$$e^{\gamma_1 \gamma_2 \theta} = 1 + \gamma_1 \gamma_2 \theta+ \frac{\theta^2}{2} \gamma_1 \gamma_2 \gamma_1 \gamma_2 + \ldots$$
But the gammas anticommute when they're different: $\gamma_1 \gamma_2 = -\gamma_2 \gamma_1$, so we get
$$e^{\theta \gamma_1 \gamma_2} = 1 + \gamma_1 \gamma_2 \theta - \frac{\theta^2}{2} - \frac{\theta^3}{6} \gamma_1 \gamma_2 + \ldots = \cos \theta + \gamma_1 \gamma_2 \sin \theta$$
So what this means is we can write the rotation of a spatial vector $a = a^i \gamma_i$ using some bivector $B = \frac{1}{2} B^{ij} \gamma_i \gamma_j$ as follows. Let $q = \exp(-\hat B\theta/2)$, where $\hat B = B/\sqrt{|BB|}$. The rotation then takes the form
$$a' = R(a) = q a q^{-1}$$
(As an exercise, you can show that, in this convention, the quaternion $i = -\gamma_2 \gamma_3$, $j =-\gamma_3 \gamma_1$ and $k = -\gamma_1 \gamma_2$.)
The bivector $B$ then represents the plane of rotation.
This logic carries over to Lorentz boosts. Let's consider a bivector of the form $\gamma_0 \gamma_1$. Crucially,
$$(\gamma_0 \gamma_1)^2 = \gamma_0 \gamma_1 \gamma_0 \gamma_1 = - \gamma_0 \gamma_1 \gamma_1 \gamma_0 = - \gamma_0 \gamma_0 = (-1)(-1) = +1$$
(This is true even if you choose the opposite sign convention.) This means the exponential takes on its hyperbolic form instead of its trig form:
$$e^{\gamma_0 \gamma_1 \phi} = \cosh \phi + \gamma_0 \gamma_1 \sinh \phi$$
So a "quaternion" for boosts instead uses the hyperbolic trig functions, as we know it should. We can write a boost in the form $p a p^{-1}$, just as we did with spatial quaternions. Lorentz boost quaternions like $p$ just use a different bivector in the exponential.
But how do we put them together?
Let's say you want to boost with respect to some plane $\gamma_0 v$, where $v$ is the spatial velocity direction, $\hat v = q \gamma_1 q^{-1}$ (so you know how it's rotated with respect to, say, the x-axis).
You should notice that $\gamma_0 q = q \gamma_0$ for any spatial quaternion $q$. $\gamma_0$ will always commute with this because because $q$ is of the form $q = \lambda = \gamma_i \gamma_j \mu$. $\gamma_0$ will commute with $1$ (if you like, the identity if you must think of it as a matrix), and $\gamma_0$ will anticommute with both of the other $\gamma_i$ and $\gamma_j$ so that there's no overall sign change.
Now, consider the product
$$(q \gamma_0 \gamma_1 q^{-1})^2 = q \gamma_0 \gamma_1 q^{-1} q \gamma_0 \gamma_1 q^{-1} = q (\gamma_0 \gamma_1)^{2} q^{-1}$$
So in the power series, the $q$ and $q^{-1}$ will constantly cancel each other out in the middle. They pull out of an exponential, so we get
$$e^{q \gamma_0 \gamma_1 q^{-1}} = q e^{\gamma_0 \gamma_1} q^{-1}$$
So now, if we want to boost a vector $a$ in an arbitrary direction, we have something of the form
$$a' = q e^{-\gamma_0 \gamma_1 \phi/2} q^{-1} a q e^{\gamma_0 \gamma_1 \phi/2} q^{-1}$$
Or, if we let $p = e^{-\gamma_0 \gamma_1\phi/2}$, define $R(a) = qaq^{-1}$ as the spatial rotation and $L(a) = pap^{-1}$ as the unrotated boost, we get
$$a' = qpq^{-1}aqpq^{-1} = RLR^{-1}(a)$$
So, to boost a vector in an arbitrary direction, you have to (1) rotate that direction back to a fixed axis, (2) boost with respect to that axis, and (3) then rotate that axis back to the arbitrary direction. This is exactly the way you've been told to describe the arbitrary boost.