Heat the olive oil in a large skillet over medium heat. Sauté the onions until they are translucent, about 7 minutes.
Add the green pepper and garlic, stir to incorporate.
Add the tomatoes and spices to the skillet, and cook for another 10–15 minutes, stirring frequently, until the tomatoes have softened and the consistency has thickened slightly. Remove the bay leaf, if using, and discard.
Use immediately, or let cool completely before storing in a jar for up to a week. Alternatively, you can freeze sofrito sauce in ice cube trays for easy tablespoon portions.