PHPackages                             joeymckenzie/sqlighter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. joeymckenzie/sqlighter

ActiveLibrary[Database &amp; ORM](/categories/database)

joeymckenzie/sqlighter
======================

A Laravel package for backing up your SQLite database.

0.1.2(1y ago)6341[5 PRs](https://github.com/JoeyMckenzie/sqlighter/pulls)MITPHPPHP ^8.3CI passing

Since Oct 28Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/JoeyMckenzie/sqlighter)[ Packagist](https://packagist.org/packages/joeymckenzie/sqlighter)[ Docs](https://github.com/joeymckenzie/sqlighter)[ RSS](/packages/joeymckenzie-sqlighter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (15)Versions (9)Used By (0)

SQLighter: Backup Commands for your SQLite Databases
====================================================

[](#sqlighter-backup-commands-for-your-sqlite-databases)

[![Latest Version on Packagist](https://camo.githubusercontent.com/15a2bd4b1e935282f0b0c9aa786c1cb7a2db184dc60178a476f5f209b888ef72/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f65796d636b656e7a69652f73716c6967687465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/joeymckenzie/sqlighter)[![GitHub Tests Action Status](https://camo.githubusercontent.com/70a03ed10b6c45becf5a8bb402a12d94b34cc60da447c3b15c93dbdb55042397/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6f65796d636b656e7a69652f73716c6967687465722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/joeymckenzie/sqlighter/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f0b10301daea3cb5f6a6986ddc130ce7eb3bf1c0c72e1710197228cc8a40eee2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6f65796d636b656e7a69652f73716c6967687465722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/joeymckenzie/sqlighter/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/77624f69e17f854c65a8eacaf68ef63df7b589f3f9a97e9fa58c657134330aa4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f65796d636b656e7a69652f73716c6967687465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/joeymckenzie/sqlighter)

SQLighter is a lightweight SQLite backup solution for Laravel applications. SQLighter provides automated backups of your SQLite database with configurable retention policies, while allowing for manual backups through an artisan command.

- 🔄 Automated SQLite database backups
- ⚙️ Configurable backup frequency
- 📦 Backup file rotation with configurable retention
- 🗂️ Automatic backup directory creation
- 🚫 Git-friendly (auto-generates appropriate .gitignore)
- 💡 Simple integration with Laravel's scheduler

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require joeymckenzie/sqlighter
```

Usage
-----

[](#usage)

After installation, publish the configuration file:

```
php artisan vendor:publish --tag="sqligther-config"
```

This will create a `config/sqligther.php` configuration file. Customize the options to fit your needs:

```
return [
    // Enable/disable automatic backups
    'enabled' => env('SQLIGHTER_ENABLED', true),

    // Hours between backups
    'frequency' => env('SQLIGHTER_FREQUENCY', 3),

    // SQLite database filename
    'database' => env('SQLIGHTER_DATABASE', 'database.sqlite'),

    // How many backup copies to maintain
    'copies_to_maintain' => env('SQLIGHTER_COPIES', 5),

    // Where to store backups (relative to database directory)
    'storage_folder' => env('SQLIGHTER_STORAGE', 'backups/'),

    // Prefix for backup files
    'file_prefix' => env('SQLIGHTER_PREFIX', 'backup'),
];
```

### Automatic Backups

[](#automatic-backups)

SQLighter automatically registers a scheduled command to perform backups based on your configuration. No additional setup is required other than ensuring your Laravel scheduler is running:

```
cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
```

Backups are configured to run every six hours by default, though can be overridden using the `sqlighter.frequency`configuration option. Any valid cron string will work:

```
return [
    // Using hour intervals
    'frequency' => 1,    // Every hour
    'frequency' => 12,   // Every 12 hours
    'frequency' => 24,   // Daily
    'frequency' => 168,  // Weekly

    // Or using cron expressions
    'frequency' => '0 * * * *',     // Every hour
    'frequency' => '0 */12 * * *',  // Every 12 hours
    'frequency' => '0 0 * * *',     // Daily at midnight
    'frequency' => '0 0 * * 0',     // Weekly on Sunday at midnight
    'frequency' => '30 2 * * *',    // Daily at 2:30 AM
];
```

### Manual Backups

[](#manual-backups)

You can also trigger a backup manually using the provided Artisan command:

```
php artisan sqlighter:backup
```

### Backup Storage

[](#backup-storage)

Backups are stored in your Laravel database directory under the configured `storage_folder` (default: `backups/`). A `.gitignore` file is automatically created to prevent backups from being committed to your repository.

### File Naming

[](#file-naming)

Backup files are named using the following format:

```
{prefix}-{timestamp}.sql

```

For example: `backup-1698765432.sql`

Testing
-------

[](#testing)

Pest is used to test the backup command. To run tests, just use the composer script:

```
composer test
```

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within SQLighter, please send an e-mail to Joey McKenzie via .

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance67

Regular maintenance activity

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

567d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb50011d6f8c359f21b7352e7e7aaa76847a6d909d625bd439bf6c4df9fcf4d0?d=identicon)[JoeyMckenzie](/maintainers/JoeyMckenzie)

---

Top Contributors

[![JoeyMckenzie](https://avatars.githubusercontent.com/u/16873254?v=4)](https://github.com/JoeyMckenzie "JoeyMckenzie (40 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![nexxai](https://avatars.githubusercontent.com/u/4316564?v=4)](https://github.com/nexxai "nexxai (3 commits)")

---

Tags

laravelphpsqlitesqlitebackupssqlighter

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/joeymckenzie-sqlighter/health.svg)

```
[![Health](https://phpackages.com/badges/joeymckenzie-sqlighter/health.svg)](https://phpackages.com/packages/joeymckenzie-sqlighter)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58723.9M36](/packages/scienta-doctrine-json-functions)[nette/caching

⏱ Nette Caching: library with easy-to-use API and many cache backends.

43518.6M368](/packages/nette-caching)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M234](/packages/nette-database)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.8M120](/packages/dibi-dibi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
