I managed to wire up the speakers in my old 2010 iMac that I’ve repurposed as a monitor. What I did:
# Remove the rectangular plugs off the end of each speaker wire. You don’t need to remove the speakers to do this, as long as you have access to both the speaker wires.
# Strip and twist the ends of each of the four wires - on mine there were two dark ones (possibly dark grey or brown? I’m a little colourblind) and two light ones (possibly light grey) on each speaker. I put some solder on each stripped end.
# I then took a standard stereo 3.5 male-to-male audio extension cable and cut one end off, stripped the outside sheath to reveal a bare metal outer layer, a white cable (L) and red cable (R). I stripped and twisted the red and white ends and soldered the ends of all three.
# Then: solder the bare metal outer layer of the audio cable to all four dark cables from the speakers, and the white cable to both light cables from the left speaker and the red cable to both light cables from the right speaker. I used some heat shrink tubing to cover the soldered joints, but you could use electrical insulating tape.
# Plug in the stereo extension cable to your iPhone to test ( you might need a lightning to 3.5mm audio adapter. Assuming it works, route the extnsion cable out through a suitable hole in the case and plug into the external speaker socket on your computer - in my case my new a Mac mini works fine this way. Not brilliant sound quality, but not that difficult to do and means you can still use the original speakers in place.