It depends what you want to achieve. If I understand it correctly, you want a PHP or Javascript class that makes partial parts of the text bold. If that's what you want, I can help you with cheap, quick work. I'm open to feedback, so I can edit if it doesn't satisfy you.
If you are okay with those, I have several questions:
What is the data you gonna use to make the text bold?
Where the data will come from?
For example, you might want to use asterisks (*) to make it look bold in the text, so that way you only need to supply the text. Or, you might want to select words by their index numbers or directly by their names. So, it would be better to know what you really need and want. Thanks in advance.