laranail/db-tools is not published to Packagist, so there is no registry-version badge to show: see Install.
Independent, framework-agnostic database utilities for Laravel — model traits (UUID/NanoID/ULID keys, JSON accessors, slugs, soft-archiving, inheritance-friendly fillable/hidden/casts/defaults), money & datetime casts, schema macros, an audit observer, backup/restore, a database CLI, cursor/offset pagination, and inspection services.
PHP ^8.4.1 || ^8.5 on Laravel ^13. Its only Laranail dependency is laranail/package-tools, which builds its service provider.
The package is not on Packagist. Add its VCS repositories, and laranail/package-tools, which it requires, to your application's composer.json (Composer reads repositories only from the root package):
"repositories": [
{ "type": "vcs", "url": "https://github.com/laranail/db-tools" },
{ "type": "vcs", "url": "https://github.com/laranail/package-tools" },
{ "type": "composer", "url": "https://repo.packagist.org", "exclude": ["laranail/*"] },
{ "packagist.org": false }
]composer require laranail/db-tools:^0.1DbToolsServiceProvider is auto-discovered and registers the schema macros at boot.
Nothing is required: the defaults work as installed. Two optional steps:
-
Publish the config to tune the key type, audit columns, money currency and backup behaviour:
php artisan vendor:publish --tag=laranail::db-tools-config
-
If you use the soft-delete restore history, publish its migration and run it:
php artisan vendor:publish --tag=laranail::db-tools-migrations php artisan migrate
use Simtabi\Laranail\DbTools\DbTools;
DbTools::testConnection(); // true
DbTools::getDriver(); // 'pgsql'
DbTools::getMissingTables(['users', 'orders', 'invoices']); // ['invoices']
DbTools::backup(storage_path('backups/nightly.sql')); // trueThe schema macros are available in any migration:
Schema::create('orders', function (Blueprint $t): void {
$t->id();
$t->auditColumns(); // created_by, updated_by, deleted_by
$t->softDeletesWithUndo(); // deleted_at + restored_at
$t->timestamps();
});The full API is in The DbTools facade; everything else is in the documentation index.
Full documentation is at opensource.simtabi.com/documentation/laranail/db-tools.
- Installation — requirements, repositories and auto-discovery.
- Getting started — a first model, migration and backup.
- Configuration — every key in
config/laranail/db-tools.php. - Architecture — how the pieces fit, and why.
- Release — versioning and the release process.
- Models: Base model · Traits · Schema traits · Soft deletes · Archiving · Casts · Observers · Eager loading · Pagination
- Schema: Macros · Migrations · Seeding · Schema inspection · Schema readiness · Table verification · Portable SQL
- Operations: Backup & restore · Database CLI · Connection testing · Availability guard · Boot without a database · Database session
- API: The DbTools facade · Services · Events
Issues and PRs are welcome — see CONTRIBUTING.md. Report vulnerabilities per SECURITY.md (security@simtabi.com); participation follows the Code of Conduct.
MIT © Simtabi LLC. See LICENSE.