Throw the trimmed green beans in a large pot of well salted boiling water and let them cook until they are cooked through but still rather al dente.
While the beans are boiling, gently sauté the chopped garlic and onion in the oil (and butter if using) in a skillet, large enough to contain the beans later, until the onion is quite soft and translucent. Add the anchovy fillets and let them melt into the seasoned oil. Turn off the heat and add the chopped parsley.
When the green beans are cooked, drain them and add them to the skillet along with a half-ladleful of the cooking water. Turn the flame back on and sauté the beans in the anchovy sauce for a minute or two to let them take on the flavor of the sauce. Any water clinging to the beans should have almost entirely evaporated. Taste and adjust for salt.
Turn the beans into a serving dish, and nap them with the remaining sauce in the skillet. Serve immediately.