Why do I spot and cramp up to 7 days before my period?

The last two years, some of my periods are so painful. Even more so than that, I've started spotting brown and getting major cramps about 7 days before my periods actually start.

What causes this and why has it developed over time?