Home » Development » Powerful database abstraction with Doctrine DBAL – Getting started
“Powerful database abstraction layer with many features for database schema introspection, schema management and PDO abstraction.”
The following will get you started, these offer the Doctrine\Common and Doctrine\DBAL namespaces.
In the end your structure should look something like that:
includes/ includes/doctrine includes/doctrine/lib includes/doctrine/lib/Doctrine includes/doctrine/lib/Doctrine/Common includes/doctrine/lib/Doctrine/DBAL
The following will add a class loader, so that all the other classes will be autoloaded.
This will setup your first connection to a MySQL database.
This will do a simple first query
DBAL gives us some nice options to prepare queries.
By using the bindValue the placeholder “?” is replaced. You can also use named parameters :)
More about this in the official documentation.
That was not too difficult ;)
Alexander Gräf
Portfolio
Book Me
Get in touch
Live Chat
I am a full-stack developer. My expertise include:
I love programming, design and know my way around server architecture as well. I would never feel complete, with one of these missing.
I have a broad range of interests, that’s why I constantly dive into new technologies and expand my knowledge where ever required. Technologies are evolving fast and I enjoy using the latest.
Apart from that, I am a peace loving guy who tries to have people around him that think the same. I truly believe in the principle: “If you help someone, someone will help you, when you need it."