DKIM Key Generator

Good day,

Do you know of a class/code that I can use to generate DKIM public/private keys or some guidance on how I can generate these keys myself with PHP?

There are generators online but I want to integrate this into a piece of software.

Thank you for any input!

All the best.

I found some, thank you.
Yet to try them out and decide which to use but I found these: