The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

Laravel Optimize Database

Laravel Optimize Database stats

Downloads
2.5K
Stars
136
Open Issues
3
Forks
6

View on GitHub →

Publishes migrations that make your database production ready.

Skeleton Php

GitHub Workflow Status (main) Total Downloads Latest Version License


This package is a work-in-progress, therefore you should not use it in production - and always backup your database before requiring it through Composer.

This package provides a simple way to optimize your SQLite database in Laravel; it's a good starting point for production-ready SQLite databases. At the time of this writing, it applies the following settings:

┌───────────────────────────┬─────────────┬───────────┐
│ Setting │ Value │ Via │
├───────────────────────────┼─────────────┼───────────┤
│ PRAGMA auto_vacuum │ incremental │ Migration │
│ PRAGMA journal_mode │ WAL │ Migration │
│ PRAGMA page_size │ 32768 │ Migration │
│ PRAGMA busy_timeout │ 5000 │ Runtime │
│ PRAGMA cache_size │ -20000 │ Runtime │
│ PRAGMA foreign_keys │ ON │ Runtime │
│ PRAGMA incremental_vacuum │ (enabled) │ Runtime │
│ PRAGMA mmap_size │ 2147483648 │ Runtime │
│ PRAGMA temp_store │ MEMORY │ Runtime │
│ PRAGMA synchronous │ NORMAL │ Runtime │
└───────────────────────────┴─────────────┴───────────┘

The settings are applied in two ways:

🚀 Installation

Requires PHP 8.2+, SQLite 3.46+ and Laravel 11.0+

You can install the package via Composer:

composer require nunomaduro/laravel-optimize-database --dev

🙌 Usage

To get started optimizing your SQLite database, you need to run the following command:

php artisan db:optimize

At this point, the [Runtime] settings are applied automatically. However, you need to run the migration to apply the [Migration] settings:

php artisan migrate

Laravel Optimize Database was created by Nuno Maduro under the MIT license.

nunomaduro photo

@laravel core member — created @pestphp, @laravel-zero, collision, larastan, pint, @openai for php, @phpinsights, termwind, and more.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Nunomaduro Laravel Optimize Database Related Articles

Optimize Your SQLite Database with the Laravel Optimize DB Package image

Optimize Your SQLite Database with the Laravel Optimize DB Package

Read article
CodeKudu logo

CodeKudu

Stand-ups, Retrospectives, and 360° Feedback for the entire team. 50% off with code LARAVELNEWS.

CodeKudu
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian