Search code examples
javadatabaselaravelapiin-memory-database

How can I use H2 database with laravel?


I am currently in a project and we need for some reason use h2 database. I would like to do an api in this project and I want to use laravel, because it is a framework I know to use. But I can't found information about connecting h2 database with laravel. Anyone knows how to do that? Is this even possible?


Solution

  • As per Laravel documentation:

    Laravel makes interacting with databases extremely simple across a variety of database backends using either raw SQL, the fluent query builder, and the Eloquent ORM.

    Currently, Laravel supports four databases:

    MySQL 5.6+ (Version Policy)
    PostgreSQL 9.4+ (Version Policy)
    SQLite 3.8.8+
    SQL Server 2017+ (Version Policy)
    

    Reference: Laravel -> Database -> Introduction