Wanted a nice and simple PHP class which could generate random codes. After looking at multiple libraries I found that sometimes it's best done yourself.
The final class can either generate a single code or an array of codes based on the parameters you set.