  $\beta$-decay properties of nuclei are investigated within the relativistic
nuclear energy density functional framework by varying the temperature and
density, conditions relevant to the final stages of stellar evolution. Both
thermal and nuclear pairing effects are taken into account in the description
of nuclear properties and in the finite temperature proton-neutron relativistic
quasiparticle random-phase approximation (FT-PNRQRPA) to calculate the relevant
allowed and first-forbidden transitions in the $\beta$-decay. The temperature
and density effects are studied on the $\beta$-decay half-lives between
temperatures $T = 0-1.5$ MeV, and at densities $\rho Y_e = 10^7$ g/cm${}^3$ and
$10^9$ g/cm${}^3$. The relevant Gamow-Teller transitions are also investigated
for Ti, Fe, Cd, and Sn isotopic chains at finite temperatures. We find that the
$\beta$-decay half-lives increase with increasing density $\rho Y_e$, whereas
half-lives generally decrease with increasing temperature. It is shown that the
temperature effects decrease the half-lives considerably in nuclei with longer
half-lives at zero temperature, while only slight changes for nuclei with short
half-lives are obtained. We also show the importance of including the
de-excitation transitions in the calculation of the $\beta$-decay half-lives at
finite temperatures. Comparing the FT-PNQRPA results with the shell-model
calculations for $pf-$shell nuclei, a reasonable agreement is obtained for the
temperature dependence of $\beta$-decay rates. Finally, large-scale
calculations of $\beta$-decay half-lives are performed at temperatures
$T_9(\text{K}) = 5$ and $T_9(\text{K}) = 10$ and densities $\rho Y_e = 10^7$
g/cm${}^3$ and $10^9$ g/cm${}^3$ for even-even nuclei in the range $8 \leq Z
\leq 82$, relevant for astrophysical nucleosynthesis mechanisms.
