CodeIgniter Forums

Full Version: Expanded driver mechanism?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Should the CI3 driver mechanism be beefed up to support additional kinds of things, like template engines ?
Granted, template engines might be a poor example, as no two have the same interface.
The driver mechanism works well for databases and sessions ... what else could it be used as a pattern for?

--------------------------------
Disclaimer: Putting forward an idea without implying any endorsement of it.
For parsers.

Edit:

email, translations (file or database based for example), maybe the Image library.

I saw a scheme http://www.webiny.com/blog/2015/02/06/th...community/ with added abstraction - something that is called "bridge" between (external?) components. I don't know whether it is sane enough.

I would use for now the term "driver" also for APIs that abstract the application from APIs of external components, installed with Composer or whatever other way. IMO it would be a good rule APIs of the external components with important common purpose (parsers, email) not to be used directly, but through interfaces provided by CodeIgniter. That would make external components replaceable.
It would be nice if the pattern were better documented, and perhaps more consistently implemented (and if drivers were more easily extended). It's difficult to see much commonality between the implementation of drivers for the database and for sessions.

I implemented a simple authentication/authorization "driver" system and one to replace the form library for Bonfire (neither of which I ever really got around to integrating into Bonfire). More recently, I implemented a driver system for the library used to convert Markdown/CommonMark documents in Bonfire's docs module.

Almost anything which allows for a (relatively) simple interface, potentially including template libraries, can be implemented like this, it's just a matter of whether it is actually useful for the specific feature and what impact it might have on the overall performance of that feature.