{"id":29215150,"url":"https://github.com/shivas/versioning-bundle","last_synced_at":"2025-07-03T00:07:52.681Z","repository":{"id":9666156,"uuid":"11606639","full_name":"shivas/versioning-bundle","owner":"shivas","description":"Simple way to version (semantic versioning 2.0.0) your Symfony2/3/4/5/6 application","archived":false,"fork":false,"pushed_at":"2024-08-14T19:34:34.000Z","size":153,"stargazers_count":112,"open_issues_count":2,"forks_count":30,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-31T15:11:19.976Z","etag":null,"topics":["php","semantic","semver","symfony-bundle","version","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/shivas.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}},"created_at":"2013-07-23T11:21:30.000Z","updated_at":"2024-09-13T23:04:15.000Z","dependencies_parsed_at":"2024-03-16T18:02:04.992Z","dependency_job_id":"8c81e39a-e24d-4b48-8332-3eb71d561629","html_url":"https://github.com/shivas/versioning-bundle","commit_stats":{"total_commits":89,"total_committers":17,"mean_commits":5.235294117647059,"dds":0.7078651685393258,"last_synced_commit":"427969bce2f139e1f7234d14efcd8cd0083d896c"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/shivas/versioning-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivas%2Fversioning-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivas%2Fversioning-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivas%2Fversioning-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivas%2Fversioning-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shivas","download_url":"https://codeload.github.com/shivas/versioning-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivas%2Fversioning-bundle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263229263,"owners_count":23434013,"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","semantic","semver","symfony-bundle","version","versioning"],"created_at":"2025-07-03T00:07:51.851Z","updated_at":"2025-07-03T00:07:52.520Z","avatar_url":"https://github.com/shivas.png","language":"PHP","readme":"versioning-bundle\n=================\n\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d6d73376-b826-46d0-85f5-fd9f77c45c06/mini.png)](https://insight.sensiolabs.com/projects/d6d73376-b826-46d0-85f5-fd9f77c45c06)\n[![Total Downloads](https://img.shields.io/packagist/dt/shivas/versioning-bundle.svg?style=flat)](https://packagist.org/packages/shivas/versioning-bundle)\n\nSimple way to version your Symfony Flex application.\n\nWhat it is:\n-\n\n- Automatically keep track of your application version using Git tags or a Capistrano REVISION file\n- Adds a global Twig variable for easy access\n- Easy to extend with new version providers and formatters for different SCM's or needs\n- Uses Semantic Versioning 2.0.0 recommendations using https://github.com/nikolaposa/version library\n- Support for manual version management\n\nPurpose:\n-\n\nTo have an environment variable in your Symfony application with the current version of the application for various needs:\n- Display in frontend\n- Display in backend\n- Anything you can come up with\n\nProviders implemented:\n-\n\n- `VersionProvider` (read the version from a VERSION file)\n- `GitRepositoryProvider` (git tag describe provider to automatically update the version by looking at git tags)\n- `RevisionProvider` (read the version from a REVISION file)\n- `InitialVersionProvider` (just returns the default initial version 0.1.0)\n\nInstallation\n-\n\nSymfony Flex automates the installation process, just require the bundle in your application!\n```console\ncomposer require shivas/versioning-bundle\n```\n\nThe version is automatically available in your application.\n```\n# Twig template\n{{ shivas_app_version }}\n\n# Or get the version from the service\npublic function indexAction(VersionManagerInterface $manager)\n{\n    $version = $manager-\u003egetVersion();\n}\n```\n\nConsole commands\n-\n\nThere are three available console commands. You only need to run the app:version:bump command when manually managing your version number.\n```console\n# Display the application version status\nbin/console app:version:status\n\n# Display all available version providers\nbin/console app:version:list-providers\n\n# Manually bump the application version\nbin/console app:version:bump\n```\n\nVersion providers\n-\n\nProviders are used to get a version string for your application. All versions should follow the SemVer 2.0.0 notation, with the exception that letter \"v\" or \"V\" may be prefixed, e.g. v1.0.0.\nThe recommended version provider is the `GitRepositoryProvider` which only works when you have at least one TAG in your repository. Be sure that all of your TAGS are valid version numbers.\n\nAdding own provider\n-\n\nIt's easy, write a class that implements the `ProviderInterface`:\n```php\nnamespace App\\Provider;\n\nuse Shivas\\VersioningBundle\\Provider\\ProviderInterface;\n\nclass MyCustomProvider implements ProviderInterface\n{\n\n}\n```\n\nAdd the provider to the container using your services file:\n```yaml\nApp\\Provider\\MyCustomProvider:\n    tags:\n        - { name: shivas_versioning.provider, alias: my_provider, priority: 0 }\n```\n\n```xml\n\u003cservice id=\"App\\Provider\\MyCustomProvider\"\u003e\n    \u003ctag name=\"shivas_versioning.provider\" alias=\"my_provider\" priority=\"0\" /\u003e\n\u003c/service\u003e\n```\n\nPlease take a look at the priority attribute, it should be between 0 and 99 to keep the providers in the right order.\n\nEnsure your provider is loaded correctly and supported:\n```console\nbin/console app:version:list-providers\n\nRegistered version providers\n ============= ========================================================= ========== ===========\n  Alias         Class                                                     Priority   Supported\n ============= ========================================================= ========== ===========\n  version       Shivas\\VersioningBundle\\Provider\\VersionProvider          100        No\n  my_provider   App\\Provider\\MyCustomProvider                             0          Yes\n  git           Shivas\\VersioningBundle\\Provider\\GitRepositoryProvider    -25        Yes\n  revision      Shivas\\VersioningBundle\\Provider\\RevisionProvider         -50        No\n  init          Shivas\\VersioningBundle\\Provider\\InitialVersionProvider   -75        Yes\n ============= ========================================================= ========== ===========\n```\n\nVersion formatters\n-\n\nVersion formatters are used to modify the version string to make it more readable. The default `GitDescribeFormatter` works in the following fashion:\n\n- if the commit sha matches the last tag sha then the tag is converted to the version as is\n- if the commit sha differs from the last tag sha then the following happens:\n  - the tag is parsed as the version\n  - the prerelease part is added with following data: \"dev.abcdefa\"\n  - where the prerelease part \"dev\" means that the version is not tagged and is \"dev\" stable, and the last part is the commit sha\n\nIf you want to disable the default formatter, use the `NullFormatter`:\n```yaml\n# app/config/services.yaml\nShivas\\VersioningBundle\\Formatter\\NullFormatter: ~\nShivas\\VersioningBundle\\Formatter\\FormatterInterface: '@Shivas\\VersioningBundle\\Formatter\\NullFormatter'\n```\n\nCreating your own version formatter\n-\n\nTo customize the version format, write a class that implements the `FormatterInterface`:\n```php\nnamespace App\\Formatter;\n\nuse Shivas\\VersioningBundle\\Formatter\\FormatterInterface;\n\nclass MyCustomFormatter implements FormatterInterface\n{\n\n}\n```\n\nThen alias the `FormatterInterface` with your own:\n```yaml\n# app/config/services.yaml\nShivas\\VersioningBundle\\Formatter\\FormatterInterface: '@App\\Formatter\\MyCustomFormatter'\n```\n\nCapistrano v3 task for creating a REVISION file\n-\n\nAdd following to your recipe\n```ruby\nnamespace :deploy do\n    task :add_revision_file do\n        on roles(:app) do\n            within repo_path do\n                execute(:git, :'describe', :\"--tags --long\",\n                :\"#{fetch(:branch)}\", \"\u003e#{release_path}/REVISION\")\n            end\n        end\n    end\nend\n\n# We get git describe --tags just after deploy:updating\nafter 'deploy:updating', 'deploy:add_revision_file'\n```\n\nGood luck versioning your project.\n\nContributions for different SCM's and etc are welcome, just submit a pull request.\n","funding_links":[],"categories":["Miscellaneous"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivas%2Fversioning-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshivas%2Fversioning-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivas%2Fversioning-bundle/lists"}