How to record a audio with iPhone via input cable like AUX from laptop
Actually all you need is an adapter cable that will provide the proper signals to the proper pins of the headphone jack. Note that if you have a phone without a headphone jack you will, first, need that lightning to headphone jack adapter that Apple sells.

The first thing I found was this article. It is much more than you were trying to do but it should work, none the less.

That article points to Amazon.com and a device called the Headset Buddy, which is nothing more than an adapter to go from a standard mini phono jack to the iPhone (and Android phone) headphone/mic jack.

Actually it may have some circuitry in it that does more than adapt a line-level input to your iPhone, not sure. No actual experience with this device.

The only thing I would be careful with (if you get the device linked above or something else comparable) is to start the output volume of your other device very low. I have experience with plugging stereos and the like into a Mac and the input level that a Mac and iPhone expect from a microphone is a lot lower than the output from your average audio out port on a PC or a stereo