“Why do I need to rewrite the code which works and working since day one ?”
Well, You don’t.!!!! Unless.
You have now come to the point where you have to adopt new requirements, and implementing a new one is not easy. What do you going to do? And that is why I do need to rewrite the code which works.
You have two choices here.

Choice One – The easy one.
You spend a little and open your messy cupboard. Fiddle around, move something, add something, assume that everything will work typically, and pretend that the new requirement fits nicely.
Pros – Quick, uncomplicated, dirty win.
Cons- Mess, harder to maintain, less confidence.
OR
Choice Two – The hard (proper) one.
You get an opportunity to make it better with newer code from the ground up and tangle it around the old one. Replace it iteratively and gradually to push new changes and avail new requirements. Write more modules and unit tests, functional tests, and integration tests, making code more resilient and adoptive to more changes in the future.
Pros – Strategic, Clean, Future proof, Confident.
Cons – Slow, Hurdles, and Frustrating (Challenging).
Now, why am I asking such a thing?
Simple. I am currently working on multiple PHP projects (never my forte) to convert into a more modular, scalable and secure full-stack app using the latest technology. Mostly Angular, Ionic, NodeJS, .net core, MySQL, NoSQL, API, Cloud, Azure, etc.
Okay. What are the benefits of doing this? The product is a liability to maintain, and this way, I can now convert it into an intellectual asset. It will become a proper Software as a Service. And currently, I am building a few things, namely loclz, vCard, WhatsApp store, Payment gateway, eCommerce and CRMs. Lot and lot of code without unit tests and without integration tests.
It is messy, and yet every piece of code is working; some of them are horrible, elegant, well written, and full of crap and shit. But I am not complaining about it. It is my job to declutter my mess and keep things tidy and organised.
Not always, though!
Well, most of the time.
So if you have been in those situations and trying to find a better way or are happy to share your stories. I would love to have a chat and understand you better. Please contact me.