It is amazing that these words were pend by the apostle who all throughout his ministry suffered at the hands of the Jews. Yes, indeed it was our beloved Paul in the midst of persistent strong persecutions and at the same time was inspired to write the book of Philippians.
As Paul records it he suffered oppression from civil government, interference from his own countrymen, and jealousy from some of his own brethren.
How did this beat up, tired and rejected saint ever find reason to rejoice while under such hardship?
The answer in not in the question how, but in whom. Paul’s answer is found in Philippians 4:13, “I can do all things through Christ who strengthens me.”
Paul understood where joy comes from as he spoke to the saints in Thessalonica saying, “For what is our hope, or joy, or crown of rejoicing? Is it not even you in the presence of our Lord Jesus Christ at His coming? 20 For you are our glory and joy.” (1Thess. 2:19:20).
Joy is directly a result of serving God in spirit and truth and knowing that we are in Him, and always in His presence. Happiness, peacefulness, and contentment are conditions that come from knowing and serving God.