Prepare a 13 by 9 - inch baking dish with nonstick cooking spray.
Preheat the oven to 375° Fahrenheit.
Bring a large pot of salted water to a boil. Add the green beans and cook for about 5 minutes, until they're bright green and just tender. Sample and boil a minute or 2 longer if you think necessary. Drain them well and set aside.
In a large skillet, melt the butter over medium heat. Add the chopped onion and cook for about 3 minutes until they start to soften.
Stir in the garlic and mushrooms, and cook another 5-6 minutes, until the mushrooms release their juices and begin to brown.
Sprinkle the flour over the mushroom mixture and stir so everything gets coated. Cook the flour for a minute then slowly whisk in the broth.
Add the half-and-half. Keep stirring until the sauce thickens, about 3-4 minutes. Season with salt and pepper to taste. Sample. Adjust seasoning if necessary.
Add the creamy mushroom mixture to the green beans and combine well. Add ½ cup of the French fried onions. If you're using cheese, mix that in half of that too.
Pour everything into a 9x13-inch baking dish and sprinkle a little more cheese on top, if you like.
Bake for 20 minutes. Then top with the remaining French fried onions and bake for another 5-10 minutes, until the top is golden and bubbly.
Remove from oven. Cool slightly before serving.
Notes
When blanching the fresh green beans, sample one before draining. If they are still too crisp for your liking, give them another minute or two and sample again. Drain well then proceed with the recipe.If you decided to use canned green beans, be aware that they are much softer and although still tasty, will not have the freshness and crispness that fresh green beans do.