{"id":30252085,"url":"https://github.com/dconco/php-schema-migrator","last_synced_at":"2025-10-03T22:29:26.178Z","repository":{"id":309110036,"uuid":"1035197417","full_name":"dconco/php-schema-migrator","owner":"dconco","description":"Laravel-Style Migrations for Any PHP Project","archived":false,"fork":false,"pushed_at":"2025-08-09T21:35:44.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-09T23:27:39.394Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dconco.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-09T21:33:20.000Z","updated_at":"2025-08-09T21:38:05.000Z","dependencies_parsed_at":"2025-08-09T23:40:48.855Z","dependency_job_id":null,"html_url":"https://github.com/dconco/php-schema-migrator","commit_stats":null,"previous_names":["dconco/php-schema-migrator"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/dconco/php-schema-migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dconco%2Fphp-schema-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dconco%2Fphp-schema-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dconco%2Fphp-schema-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dconco%2Fphp-schema-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dconco","download_url":"https://codeload.github.com/dconco/php-schema-migrator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dconco%2Fphp-schema-migrator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270558924,"owners_count":24606615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"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":[],"created_at":"2025-08-15T11:10:37.962Z","updated_at":"2025-10-03T22:29:26.172Z","avatar_url":"https://github.com/dconco.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Schema Migrator\n\nA beautiful command-line database migration tool for any PHP project. Laravel-style migrations without the framework complexity.\n\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n\n## Features\n\n✨ **Beautiful CLI Interface** - Powered by Symfony Console with colored output and interactive commands  \n🚀 **Global Installation** - Install once, use anywhere in any PHP project  \n🔧 **Zero Dependencies** - No need to install Laravel or any framework in your projects  \n📁 **Project-Based Config** - Each project maintains its own configuration and migrations  \n🗄️ **Multi-Database Support** - MySQL, PostgreSQL, SQLite, and SQL Server  \n⚡ **Laravel-Compatible** - Uses Laravel's proven migration syntax and features  \n\n---\n\n## Global Installation\n\nInstall Schema Migrator globally via Composer:\n\n```bash\ncomposer global require dconco/schema-migrator\n```\n\nMake sure your global Composer bin directory is in your PATH:\n\n```bash\n# Add to your ~/.bashrc or ~/.zshrc\nexport PATH=\"$PATH:$HOME/.composer/vendor/bin\"\n```\n\n---\n\n## Quick Start\n\n### 1. Initialize in Your Project\n\nNavigate to your PHP project and initialize Schema Migrator:\n\n```bash\ncd /path/to/your/project\nschema-migrator init\n```\n\nThis will:\n- Create a `schema-migrator.yml` configuration file\n- Create a `database/migrations` directory\n- Prompt you for database connection details\n\n### 2. Create Your First Migration\n\n```bash\nschema-migrator make:migration CreateUsersTable\n```\n\n### 3. Edit the Migration\n\nEdit the generated file in `database/migrations/`:\n\n```php\n\u003c?php\n\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Capsule\\Manager as Capsule;\n\nreturn new class extends Migration {\n    public function up(): void\n    {\n        Capsule::schema()-\u003ecreate('users', function (Blueprint $table) {\n            $table-\u003eid();\n            $table-\u003estring('name');\n            $table-\u003estring('email')-\u003eunique();\n            $table-\u003etimestamp('email_verified_at')-\u003enullable();\n            $table-\u003estring('password');\n            $table-\u003etimestamps();\n        });\n    }\n\n    public function down(): void\n    {\n        Capsule::schema()-\u003edropIfExists('users');\n    }\n};\n```\n\n### 4. Run Migrations\n\n```bash\nschema-migrator migrate\n```\n\n---\n\n## Commands\n\n### Initialize Project\n```bash\nschema-migrator init\n```\nCreates configuration and migrations directory in current project.\n\n### Create Migration\n```bash\nschema-migrator make:migration CreatePostsTable\nschema-migrator make:migration AddEmailToUsersTable\n```\nCreates a new migration file with timestamp.\n\n### Run Migrations\n```bash\nschema-migrator migrate\n```\nExecutes all pending migrations.\n\n### Check Status\n```bash\nschema-migrator migrate:status\n```\nShows which migrations have been executed and which are pending.\n\n### Rollback Migrations\n```bash\nschema-migrator migrate:rollback\nschema-migrator migrate:rollback --steps=3\n```\nRolls back the last batch of migrations (or specified number of batches).\n\n---\n\n## Configuration\n\nThe `schema-migrator.yml` file contains your project's configuration:\n\n```yaml\ndatabase:\n  driver: mysql          # mysql, pgsql, sqlite, sqlsrv\n  host: 127.0.0.1\n  port: 3306\n  database: your_database\n  username: your_username\n  password: your_password\n  charset: utf8mb4\n  collation: utf8mb4_unicode_ci\n  prefix: ''\nmigrations:\n  table: migrations\n  path: database/migrations\n```\n\n---\n\n## Usage Examples\n\n### Project Structure\n```\nyour-project/\n├── schema-migrator.yml\n├── database/\n│   └── migrations/\n│       ├── 2025_01_01_000000_create_users.php\n│       ├── 2025_01_01_000001_create_posts.php\n│       └── 2025_01_01_000002_add_category_to_posts.php\n├── src/\n└── composer.json\n```\n\n### Migration Examples\n\n**Create a table:**\n```php\nCapsule::schema()-\u003ecreate('posts', function (Blueprint $table) {\n    $table-\u003eid();\n    $table-\u003estring('title');\n    $table-\u003etext('content');\n    $table-\u003eforeignId('user_id')-\u003econstrained();\n    $table-\u003etimestamps();\n});\n```\n\n**Add columns:**\n```php\nCapsule::schema()-\u003etable('users', function (Blueprint $table) {\n    $table-\u003estring('phone')-\u003enullable();\n    $table-\u003eboolean('is_active')-\u003edefault(true);\n});\n```\n\n**Create indexes:**\n```php\nCapsule::schema()-\u003etable('posts', function (Blueprint $table) {\n    $table-\u003eindex('title');\n    $table-\u003eindex(['user_id', 'created_at']);\n});\n```\n\n---\n\n## Multiple Projects\n\nSchema Migrator works per-project. You can use it in multiple projects simultaneously:\n\n```bash\ncd /project-a\nschema-migrator init      # Configure for project A\nschema-migrator migrate\n\ncd /project-b  \nschema-migrator init      # Configure for project B  \nschema-migrator migrate\n```\n\nEach project maintains its own configuration and migration state.\n\n---\n\n## Requirements\n\n- PHP 8.1 or higher\n- PDO extension for your database\n- Composer (for global installation)\n\n---\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n---\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n---\n\n**Now you have Laravel-style migrations in any PHP project!** 🎉","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdconco%2Fphp-schema-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdconco%2Fphp-schema-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdconco%2Fphp-schema-migrator/lists"}