I had a similar problem with the lightning port on my iPhone 5 (after about 16 months). It turned out to be an accumulation of dust or pocket lint jammed into the top end of the lightning port, which was preventing the plug going all the way in, resulting in some pins not making good contact.What I need for myself though is a new Lightning Port. After plugging it in, I now have to pull the plug sideways for my iPhone to charge...
I was able to get the dirt out (after turning the phone off) with a suitable pair of tweezers and decent light. Good as new afterwards.