Yes, this is true. This kind of property for a model category is a consequence of what is sometimes abusively called the "SM7" axiom for the enrichment:
- In $R$-modules, suppose that $A \to B$ is a cofibration and $C \to D$ is a fibration. Then the natural map of $R$-modules
$$
Hom_R(B,C) \to Hom_R(A,C) \times_{Hom_R(A,D)} Hom_R(B,D)
$$
is a fibration of $R$-modules, which is a weak equivalence if either of the original maps is.
(If the enrichment were, instead, an enrichment in simplicial sets, then this would genuinely be Quillen's SM7 axiom for simplicial model categories.)
Let's suppose for the time being that $N \to M$ is a cofibration and a weak equivalence, $N$ is cofibrant, and $P$ is an arbitrary fibrant $R$-module. Applying the SM7 axiom to $N \to M$ and $P \to *$ shows that $Hom_R(M,P) \to Hom_R(N,P)$ is (a fibration and) a weak equivalence.
This shows $Hom_R(-,P)$ takes acyclic cofibrations between cofibrant objects to equivalences; Ken Brown's lemma then implies that it takes arbitrary weak equivalences between cofibrant objects to equivalences.
A dual proof shows that, if $Q$ is cofibrant, $Hom_R(Q,-)$ takes weak equivalences between fibrant objects to equivalences.
When $N$ and $M$ are cofibrant-fibrant, we then find that all relevant maps of Hom-objects induced by pre- or post-composition with $\phi$ are equivalences.
Side note: There's a subtlety here if you're using one of the "positive" model structures of Shipley's "A convenient model category for commutative ring spectra" (called the S-model structure there). There, in order for things to be homotopically well-behaved, you have to interpret the positive model structure as actually enriched in the ordinary stable model structure (Shipley proves this version of the SM7 axiom and more).
Further side note: You didn't ask, but you might worry about whether you can soup this up to an equivalence of $R$-algebras. You can, but only up to a "zigzag" weak equivalence (which can't be gotten around in general) by using the endomorphism object of the map $\phi$ -- I learned this technique from Rezk's thesis. (For enrichments in spaces, an earlier paper of Dwyer and Kan gives a much more powerful tool for constructing derived endomorphism spaces.) A proof that you get equivalent endomorphism algebras (which also provides functoriality in weak equivalences, but only in the homotopy category of algebras) can be found in Section 2 of this paper.