PHP code example of swiss-devjoy / laravel-optimize-sqlite

1. Go to this page and download the library: Download swiss-devjoy/laravel-optimize-sqlite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

swiss-devjoy / laravel-optimize-sqlite example snippets


return [
    // add, remove or modify SQLite settings to optimize performance. all settings are PRAGMA statements, like "PRAGMA journal_mode = WAL;"
    'general' => [
        'journal_mode' => 'WAL',
        'auto_vacuum' => 'incremental',
        'page_size' => 32768, // 32 KB
        'busy_timeout' => 5000, // 5 seconds
        'cache_size' => -20000,
        'foreign_keys' => 'ON',
        'mmap_size' => 134217728, // 128 MB
        'temp_store' => 'MEMORY',
        'synchronous' => 'NORMAL',
    ],

    // You can override the general settings for specific database connections, defined in config/database.php
    'databases' => [
        'example_connection' => [
            'busy_timeout' => 10000, // override general settings and set 10 seconds
            'temp_store' => null, // unset temp_store from general settings
        ],
    ],
];
bash
php artisan vendor:publish --tag="laravel-optimize-sqlite-config"

    "scripts": {
        "dev-migrate": [
            "Composer\\Config::disableProcessTimeout",
            "rm -f database/*.sqlite",
            "touch database/database.sqlite",
            "@php artisan migrate --seed --ansi",
            "@php artisan cache:clear"
        ]
    },