Short range sensor

I want to count car miniatures passing in a narrow path ( 5 to 10 cm).
What kind of sensor could i use in this situations?

Infra Red (IR) , here just an example: VCNL4010 Proximity/Light sensor : ID 466 : $7.50 : Adafruit Industries, Unique & fun DIY electronics and kits
If you can mount LED behind the object and Photodiode on the other side, than you may use cheap version of light-beam breaker

Something like this, for the cheap version?