{"id":27446929,"url":"https://github.com/andreypostal/php-stuff-versioned","last_synced_at":"2025-07-10T16:39:00.003Z","repository":{"id":287948569,"uuid":"966340277","full_name":"andreypostal/php-stuff-versioned","owner":"andreypostal","description":"A light library with zero dependency that provides a version manager and interfaces for version control anything and with any desired backend.","archived":false,"fork":false,"pushed_at":"2025-04-14T19:48:25.000Z","size":14,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T17:05:11.279Z","etag":null,"topics":["php","php-library","version","version-control","version-manager","versioning"],"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/andreypostal.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-04-14T19:18:02.000Z","updated_at":"2025-04-18T15:47:20.000Z","dependencies_parsed_at":"2025-04-14T19:55:32.235Z","dependency_job_id":"08de2072-74d0-477e-95ad-29c88917066f","html_url":"https://github.com/andreypostal/php-stuff-versioned","commit_stats":null,"previous_names":["andreypostal/php-stuff-versioned"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/andreypostal/php-stuff-versioned","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypostal%2Fphp-stuff-versioned","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypostal%2Fphp-stuff-versioned/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypostal%2Fphp-stuff-versioned/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypostal%2Fphp-stuff-versioned/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreypostal","download_url":"https://codeload.github.com/andreypostal/php-stuff-versioned/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreypostal%2Fphp-stuff-versioned/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264608262,"owners_count":23636695,"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","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":["php","php-library","version","version-control","version-manager","versioning"],"created_at":"2025-04-15T05:59:36.478Z","updated_at":"2025-07-10T16:38:59.972Z","avatar_url":"https://github.com/andreypostal.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stuff Versioned\n[![Coverage Status](https://coveralls.io/repos/github/andreypostal/php-stuff-versioned/badge.svg?branch=main\u0026t=1)](https://coveralls.io/github/andreypostal/php-stuff-versioned?branch=main\u0026t=1)\n\nThis is a light library with zero dependency that provides\na version manager and interfaces for version\ncontrol anything and with any desired backend (like file, mysql, mongodb, postgresql...)\n\n## Installation\n\n```\ncomposer require andreypostal/php-stuff-versioned\n```\n\n## Available backends\n\n- [MongoDB](https://github.com/andreypostal/php-stuff-versioned-mongo)\n\n## Usage\n\nCreate your versions implementing the [VersionInterface](./src/VersionInterface.php).\nThis can be used to version stuff like data seed, data migrations, system updates....\n\nThe versioning process is controlled by the ID and can be used dynamically, like to perform\nversioning based on users or organization.\n\n[BackendInterface](./src/BackendInterface.php) defines the structure\nneeded to persist the versioning progress/history and will be used as checkpoints\nin the versioning process, ensuring we don't re-execute previous successful versions.\n\nThe only actual code shipped by this library is the [VersionManager](./src/VersionManager.php)\nwhich only control the version list and the execution (run process) ensuring that we do not execute\nthe same version id twice.\n\nThe order of version inclusion in the VersionManager maters and old versions should never\nchange position or be removed. If some old version should not be executed on new environments, you should just\nskip if by returning 'false' in the check process.\n\nSome simple library usage may look like:\n\n```php\n\n$manager = new \\Andrey\\StuffVersioned\\VersionManager(\n    new MongoBackend(), // the chosen backend\n    $logger, // this is optional\n);\n$manager-\u003eaddVersion(new MyVersion_2025_03_01());\n$manager-\u003eaddVersion(new MyVersion_2025_03_02());\n// or\n$manager = $manager\n    -\u003ewithVersion(new MyVersion_2025_03_03())\n    -\u003ewithVersion(new MyVersion_2025_03_04());\n    \n// New versions should be added here at the end\n\n$manager-\u003erun();\n```\n\nAnd your version implementation may look like:\n\n```php\n\nclass MyVersion_2025_03_01 implements \\Andrey\\StuffVersioned\\VersionInterface\n{\n    public function check(): bool\n    {\n        return true;\n    }\n\n    public function run(): void\n    {\n        // Create some data    \n    }\n\n    public function rollback(): void\n    {\n        // Delete partially created data    \n    }\n\n    public function getId(): string\n    {\n        return 'MyVersion_2025_03_01';\n    }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreypostal%2Fphp-stuff-versioned","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreypostal%2Fphp-stuff-versioned","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreypostal%2Fphp-stuff-versioned/lists"}