renderbit/laravel-db-url-replacer

Artisan command to search and replace URLs in the database across text columns

Maintainers

Package info

github.com/RenderbitTechnologies/laravel-db-url-replacer

pkg:composer/renderbit/laravel-db-url-replacer

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.0 2026-06-26 14:05 UTC

This package is auto-updated.

Last update: 2026-06-26 23:20:37 UTC


README

Tests Latest Version on Packagist PHP Version License

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