Support the ongoing development of ā†’

Viewing Laravel Databases in VS Code

27 Mar, 2024 3 min read

The majority of VS Code users prefer to use the integrated terminal rather than the system terminal/cli app. As developers, we love and appreciate the advantages of such integrations.

Using the VS Code integrated terminal as a case study, two major advantages stand out, as explained below:

  1. Less context-switching. The lesser you have to switch from one app to another, the better the Developer Experience. Thus, any workflow or tool that reduces context-switching is a great appeal, as it is with the VS Code integrated terminal.

  2. Contextual integration. Another advantage of using the integrated VS Code terminal rather than the default/stock OS tool is that we now enjoy integrations related to IDE context. e.g. cwd defaults to the root of the currently opened project, links/paths from command outputs in the integrated terminal are clickable and can even be used to open files from the terminal in the IDE, etc.

The above are just a few of the advantages when VS Code provides integrations for tools.

The above begs the question: why can't we have the same experience when working with databases? Databases are one of the recurring themes in Laravel apps. Why do we have to configure our database credentials in the .env file, and also configure it in another database GUI desktop app? Why do we have to switch from VS Code to TablePlus/phpMyAdmin/whatever-your-favourite-database-desktop-app-is, especially if it is for the sole purpose of viewing database records and not for some database administration tasks?

Enters DevDb!

DevDb is a Laravel first, framework- and language-agnostic VS Code extension that auto-loads databases without the need for configuring database connection separately from what you already have in application code. It currently supports SQL, MySQL, and Postgres databases, with plans to support more databases in the future.

Its advantages are similar to what we discussed above regarding the integrated terminal in VS Code.

DevDb features

  1. It auto-loads your database and shows your data right inside VS Code. In a Laravel project, this is done by processing some files like config/database.php, docker-compose.yml, and .env
  2. If it cannot auto-load your database (yet šŸ˜‰), you simply provide a .devdbrc file in the root of your application. This is why you can use it in any framework and any programming language
  3. It can open any table in your app using the context menu feature. The example below is from a Node JS project: image
  4. It provides Code Lens for Laravel Eloquent models image
  5. It has dark mode! I mean, why not? šŸ˜œ
  6. When you're not in a hurry and idle, it tells actual dad jokes: image
  7. And what's more? It's Open Source! You can tinker with the source code and PR anything you're missing as long as it's okay šŸ˜Š.

You can start using DevDb in your Laravel apps right now. Check it out in the VS Code marketplace.

Last updated 3 months ago.

driesvints, damms005 liked this article

Like this article? Let the author know and give them a clap!

Other articles you might like

November 7th 2023

Build a Quick & Easy Instant Search User Interface using Alpine AJAX & Laravel

Iā€™m going to walk you through how to easily add an instant search filter in your Laravel apps. When...

Read article
July 3rd 2024

Lawman: Pest Architecture Testing for Saloon API Integrations

Introduction If you've been reading my content for a while, you'll likely know that I love building...

Read article
June 17th 2024

Laravel Advanced: Top 5 Scheduler Functions You Might Not Know About

In this article series, we go a little deeper into parts of Laravel we all use, to uncover functions...

Read article

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.