This depends on what you want to do in LP. If you just want to visit some temples, climb up Mount Phousi, walk and eat along the Mekong and Nam Khan rivers, walk around town, or visit the night market, probably a few (3-4) days would be sufficient. Most everything is close together and within walking distance. If you want to take a cooking class, visit an elephant sanctuary, or go out to Kuang Si Falls, each of those would take much of a day.
LP moves at a pretty relaxed and slow pace, so you shouldn't feel rushed. There's a say about the Lao PDR that PDR means Please Don't Rush. We were there for 6D/5N and did all the things I listed above with a lot of time to spare. I thought it was a tad bit long of a stay, but that's just me as I prefer a slightly faster-pace city.