What do I need to write a db connection extension?

I have a lubrary in PHP for database connection and want to use it in Yii2 making a some kind of wrapper by Yii2 standad.
How to do that?

P.S. Please, don’t suggest to use an existing component
P.P.S Принимаю ответы и на русском.

Regarding answers in Russian language, you can also post the question in the /International/Russian section. (This section is in english. Everybody should be able to follow the english discussion without use of a translation service.)

Check how DB drivers are implemented (see SQLite for example) and do the same.

Is that some exotic DB btw.?

Or is your db library written for a standard db like MySQL, PostgresSQL, or MSSQL that is already supported by Yii?