Wired vs SMD resistor on 230V optocoupler input
SMD resistors are perfectly acceptable for this purpose.  You need to choose your resistors for both voltage and power rating.  You also have the option to use more than two resistors like you have shown: the space occupied by having two resistors in series in each leg (4 resistors total) is still tiny compared to the through-hole resistors you used previously.

Be sure to size your resistors to handle possible over-voltage conditions.  You can also specify resistors that are either fusible or flame-proof if required by your certifying authority.