Terbinafine falls under the class of allylamine antifungals. It works by inhibiting the enzyme squalene epoxidase, which is essential for the synthesis of ergosterol, a key component of fungal cell membranes. This leads to the accumulation of squalene within the fungal cell, causing cell death.