Two different cables failing in exactly the same way finally convinced me the charger wasn’t the problem. The phone would show the charging symbol, then disconnect if it shifted even a few millimetres on the desk. Rather than buying a third cable, I went down the iphone repair route and had the port and power connection looked at properly. The cause was found quickly, charging became stable again, and I stopped doing that ridiculous thing where the cable had to be balanced against a mug all night just to keep power flowing.