renderbit / laravel-db-url-replacer
Artisan command to search and replace URLs in the database across text columns
Package info
github.com/RenderbitTechnologies/laravel-db-url-replacer
pkg:composer/renderbit/laravel-db-url-replacer
v1.2.0
2026-06-26 14:05 UTC
Requires
- php: ^8.0
- doctrine/dbal: ^3.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^6.0|^7.0|^8.0|^9.0|^10.0
Conflicts
- phpunit/phpunit: <8.5.21
This package is auto-updated.
Last update: 2026-06-26 23:20:37 UTC
README
A Laravel Artisan command to search and replace URLs across your database tables. Supports:
- Targeting all text-type columns (
varchar,text,longtext,mediumtext,char,string) in all tables by default - Limiting to specific tables or columns using options
- Validates both old and new URLs, plus table and column existence
- Dry run mode to preview changes without modifying data
- Summary output with affected rows per table/column
Installation
composer require --dev renderbit/laravel-db-url-replacer
Package auto-discovery is supported — no manual provider registration needed.
Compatibility
| PHP | Laravel |
|---|---|
| 8.0–8.4 | 8–12 |
Usage
php artisan db:replace-url "http://old.url" "https://new.url"
Options
| Option | Description |
|---|---|
--tables=table1,table2 |
Comma-separated list of tables to limit the replacement to |
--columns=col1,col2 |
Comma-separated list of columns to limit the replacement to |
--dry-run |
Preview what would be changed without modifying any data |
Examples
# Replace across all text columns in all tables php artisan db:replace-url "http://old.example.com" "https://new.example.com" # Target only specific tables php artisan db:replace-url "http://old.example.com" "https://new.example.com" --tables=posts,comments # Target only specific columns php artisan db:replace-url "http://old.example.com" "https://new.example.com" --columns=content,excerpt # Preview changes without writing php artisan db:replace-url "http://old.example.com" "https://new.example.com" --dry-run
Testing
composer install vendor/bin/phpunit
Tests are run automatically via GitHub Actions on push and pull requests, across the full PHP/Laravel compatibility matrix.
License
MIT