When I made my first Reprap'ed Milestag gun I designed a small PCB to allow the IR sensors to be connected to the gun housing
with a curly RJ10 lead. I initially fastened this PCB to the baseball cap by fastening them with tie-wraps. Hardly satisfactory.
I didn't advance on this rather crude method until now. I designed a small box to contain the PCB with mounting tabs to allow it to be fastened to the basball cap with press studs.
It has two slots on the top and bottom halves for the PCB to slot into and some tabs for studs to be attached: