{"id":25656496,"url":"https://github.com/gggordon/php-sql-replacer","last_synced_at":"2026-06-18T11:32:12.595Z","repository":{"id":56983119,"uuid":"304763040","full_name":"gggordon/php-sql-replacer","owner":"gggordon","description":"Replace values in SQL inserts even if serialized using PHP","archived":false,"fork":false,"pushed_at":"2020-10-19T02:51:19.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-17T11:01:38.995Z","etag":null,"topics":["copy","migration","php","replace-text","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gggordon.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-16T23:59:18.000Z","updated_at":"2020-10-19T13:46:47.000Z","dependencies_parsed_at":"2022-08-21T12:20:19.154Z","dependency_job_id":null,"html_url":"https://github.com/gggordon/php-sql-replacer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/gggordon/php-sql-replacer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggordon%2Fphp-sql-replacer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggordon%2Fphp-sql-replacer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggordon%2Fphp-sql-replacer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggordon%2Fphp-sql-replacer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gggordon","download_url":"https://codeload.github.com/gggordon/php-sql-replacer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggordon%2Fphp-sql-replacer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34489066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copy","migration","php","replace-text","sql"],"created_at":"2025-02-23T22:35:02.803Z","updated_at":"2026-06-18T11:32:12.565Z","avatar_url":"https://github.com/gggordon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/gggordon/php-sql-replacer.svg?branch=main)](https://travis-ci.org/gggordon/php-sql-replacer)\n[![Scrutinizer](https://img.shields.io/scrutinizer/g/gggordon/php-sql-replacer.svg?style=flat-square)](https://scrutinizer-ci.com/g/gggordon/php-sql-replacer/)\n[![Codecov](https://img.shields.io/codecov/c/github/gggordon/php-sql-replacer.svg?style=flat-square)](https://codecov.io/gh/gggordon/php-sql-replacer)\n[![License](https://poser.pugx.org/gggordon/php-sql-replacer/license?format=flat-square)](https://packagist.org/packages/gggordon/php-sql-replacer)\n[![Latest Stable Version](https://poser.pugx.org/gggordon/php-sql-replacer/version?format=flat-square)](https://packagist.org/packages/gggordon/php-sql-replacer)\n[![Latest Unstable Version](https://poser.pugx.org/gggordon/php-sql-replacer/v/unstable?format=flat-square)](//packagist.org/packages/gggordon/php-sql-replacer)\n\n# PHP SQL Replacer\n\nA utility to replace strings/values in `SQL`  files especially with **serialized** `php` values. Useful for database migrations/clones. \n\n# Installation\n\n```\ncomposer require gggordon/php-sql-replacer\n```\n\n# Usage\n\n## Command Line Usage\n\n```\n./bin/php-sql-replacer --input-file-path=\"./original.sql\" --output-file-path=\"./updated.sql\" --match=\"Original Text\" --replace=\"New Text\"\n\nRequired Options:\n--input-file-path   : Path of input file\n--output-file-path  : Path of output file\n--match             : Exact string to look for\n--replace           : String to replace match with\n\n```\n\n## Using Code\n\nIf you already have the contents stored as a string, you may follow the example below to replace the contents.\n```php\n\u003c?php\n\nrequire_once dirname(__FILE__) . '/vendor/autoload.php';\n\n$contents =\"insert into test (column1, column2) values ('I like trading','Another Value')\";\n\n$replacer = new \\PhpSqlReplacer\\PhpSqlReplacer();\n$updatedContents = $replacer-\u003ereplaceValue(\n    $contents, \n    \"trading\", \n    \"butter\"\n);\n\necho $updatedContents;\n```\nto get the following output:\n```sql\ninsert into test (column1, column2) values ('I like butter','Another Value')\n```\n\n**OR**\n\nIf you are extracting the contents from a file:\n\n```php\n\u003c?php\n\nrequire_once dirname(__FILE__) . '/vendor/autoload.php';\n\n$replacer = new \\PhpSqlReplacer\\PhpSqlReplacer();\n$updatedContents = $replacer-\u003ereplaceValueFromFile(\"/path/to/original_file.sql\", \"trading\", \"butter\", \"/path/to/output_file.sql\");\n\necho $updatedContents;\n```\nto get the following output:\n```sql\ninsert into test (column1, column2) values ('I like butter','Another Value')\n```\nand a new file created at `/path/to/output_file.sql`.\n\n# Tests\n\nTesting done using [`phpunit`](https://phpunit.de/)\n\n```\nphpunit\n```\n\n# Documentation\n\nDocumentation Generated using [`phpdox`](http://phpdox.de/)\n\n```\nphpdox\n```\n\n# License\n\nMIT License\n\n# Maintained by\n\n[ gggordon](https://github.com/gggordon)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgggordon%2Fphp-sql-replacer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgggordon%2Fphp-sql-replacer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgggordon%2Fphp-sql-replacer/lists"}