We address the implementation of the positive operator-valued measure (POVM) describing the optimal M-outcomes discrimination of the polarization state of a single photon. Initially, the POVM elements are extended to projective operators by Naimark theorem, then the resulting projective measure is implemented by a Knill-Laflamme-Milburn scheme involving an optical network and photon counters. We find the analytical expression of the Naimark extension and the detection scheme that realise it for an arbitrary number of outcomes M = 2^N.