Get Laravel database for your non laravel projects. Built on top of illuminate/database to provide migration, seeding and artisan support

Installs: 31 331

Dependents: 2

Suggesters: 0

Security: 0

Stars: 82

Watchers: 8

Forks: 12

Open Issues: 4


8.83.0 2022-02-14 02:20 UTC

This package is auto-updated.

Last update: 2024-06-20 15:43:13 UTC


Laravel Database

Provides full laravel database functionality for your non laravel projects adds Migration, Seeding and Artisan support to Illuminate Database.

It enables artisan command line tool with:

Available commands:

  db                Start a new database CLI session
  dump-autoload     Regenerate framework autoload files
  env               Display the current framework environment
  help              Display help for a command
  inspire           Display an inspiring quote
  list              List commands
  migrate           Run the database migrations
  serve             Serve the application on the PHP development server
  tinker            Interact with your application
  db:seed           Seed the database with records
  db:wipe           Drop all tables, views, and types

  make:command      Create a new Artisan command
  make:controller   Create a new controller class
  make:factory      Create a new model factory
  make:migration    Create a new migration file
  make:model        Create a new Eloquent model class
  make:seeder       Create a new seeder class
  migrate:fresh     Drop all tables and re-run all migrations
  migrate:install   Create the migration repository
  migrate:refresh   Reset and re-run all migrations
  migrate:reset     Rollback all database migrations
  migrate:rollback  Rollback the last database migration
  migrate:status    Show the status of each migration
  vendor:publish    Publish any publishable assets from vendor packages

Laravel is a web application framework with expressive, elegant syntax. We extracted the database functionality from it and made it available for other frameworks.

The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style ORM, and schema builder. It currently supports MySQL, Postgres, MSSQL Server, and SQLite. We combined it with Illuminate FileSystem and Illuminate Console to make Artisan work with database related commands.


Install Composer

Laravel Database utilizes Composer to manage its dependencies. First, download a copy of the composer.phar. Once you have the PHAR archive, you can either keep it in your local project directory or move to usr/local/bin to use it globally on your system. On Windows, you can use the Composer Windows installer.

Install Laravel Database

Install Laravel Database by issuing the Composer create-project command in your terminal:

composer create-project laravel/database --prefer-dist

Usage Instructions

From your public index.php include the autoload.php in bootstrap folder this internally uses composer autoloader. This enables lazy loading of all db related classes. It doest not boot the database engine until you call one of the DB related class.

Adding More Components

For instructions on how to add more laravel components or compatible third party service providers etc., read the comments in app/config/app.php file

Practical Usage Example

Official Documentation

Documentation for the entire framework can be found on the Laravel website. Refer to all database related sections from there.


All the credits for the Laravel Database goes to the Laravel Framework developers. We are only putting the pieces together here


Issues and pull requests relating to this integration should be filed on the laravel/database repository.


The Laravel Database is open-sourced software licensed under the MIT license