Many people have done battery replacement on older iPhones. iFixit has guides for such. The problem is finding quality batteries that keep a charge and don't die within a few months.
I had the battery in my iPhone 6 Plus replaced a year ago at the Apple Store. It was $79 and restored it to like it was when I first bought it. Prior to that it was very erratic and would shut down with 30% battery life left on indicator.