Tinkerwell 5: Welcome to the AI age
See what's new
Tinkerwell background image
Tinkerwell Logo Tinkerwell
Go back to Blog

Fetching blog posts from the database with Tinkerwell and Symfony

Tinkerwell supports multiple frameworks and platforms – Symfony is one of them. In this example, we're using the exposed variables of the Symfony driver for Tinkerwell and fetching a blog post from the database to display it's title.

Tinkerwell up to 3.7 contains a broken driver and you need to use the updated driver as custom driver until the fix has been released with 3.8

The Symfony driver exposes the variables $kernel and $container to access classes that get loaded via dependency injection in a normal application context. This makes it possible to get a service from the container and use it like you would use it in a controller.

$doctrine = $container->get('doctrine')->getManager();
$doctrine->getRepository(App\Entity\Post::class)->find(1)->getTitle();

If you use Symfony and run a blog/teach how to use it, feel free to contact us at [email protected] for a Tinkerwell license. We'd love to learn what Tinkerwell can do for Symfony developers and write blog posts about this.

Tinkerwell - Trusted by the best.

"Tinkerwell is the perfect tool to explore ideas in code in a non-destructive way. It's like a creative coding playground. I use it almost daily."

Bastian Allgeier, Founder of Kirby CMS
Bastian Allgeier
Founder of Kirby CMS

"Tinkerwell is like if you mixed a whiteboard with a PHP interpreter and yet it runs under the context of your codebase. Relying on a scratchpad is dead."

Elijah Ervin, Internal Application Engineer
Elijah Ervin
Internal Application Engineer

Tinkerwell: The PHP Scratchpad

The must-have companion to your favorite IDE. Quickly iterate on PHP code within the context of your web application.

Buy now Learn more