{"id":25809886,"url":"https://github.com/antogno/gitinfo","last_synced_at":"2026-05-01T22:35:50.165Z","repository":{"id":147536416,"uuid":"618879401","full_name":"antogno/gitinfo","owner":"antogno","description":"GitInfo is a tool that lets you get information about the current Git repository.","archived":false,"fork":false,"pushed_at":"2023-03-25T16:45:35.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-01T22:35:49.965Z","etag":null,"topics":["composer","composer-package","git","packagist","php","tool"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/antogno/gitinfo","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antogno.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":"2023-03-25T16:07:15.000Z","updated_at":"2025-01-02T13:11:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0db9b6a-ea64-4299-83ed-b3bf6f0f407c","html_url":"https://github.com/antogno/gitinfo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/antogno/gitinfo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antogno%2Fgitinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antogno%2Fgitinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antogno%2Fgitinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antogno%2Fgitinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antogno","download_url":"https://codeload.github.com/antogno/gitinfo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antogno%2Fgitinfo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32515838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["composer","composer-package","git","packagist","php","tool"],"created_at":"2025-02-27T23:25:05.170Z","updated_at":"2026-05-01T22:35:50.157Z","avatar_url":"https://github.com/antogno.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitInfo\n\n\u003cp\u003e\n    \u003ca href=\"https://github.com/antogno/gitinfo/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/antogno/gitinfo\" alt=\"License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/antogno/gitinfo/commits\"\u003e\u003cimg src=\"https://img.shields.io/github/last-commit/antogno/gitinfo\" alt=\"Last commit\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/antogno/gitinfo/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/tag/antogno/gitinfo?label=last%20release\" alt=\"Last release\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nGitInfo is a tool that lets you get information about the current Git repository.\n\n---\n\n## Installation\n\nUse the dependency manager [Composer](https://getcomposer.org/download/) to install GitInfo.\n\n```console\n$ composer require antogno/gitinfo\n```\n\n## Usage\n\n```php\nuse antogno\\GitInfo\\GitInfo;\n\n$GitInfo = new GitInfo();\n```\n\nGet the Git version:\n\n```php\n$GitInfo-\u003egetGitVersion();\n// For example: string(6) \"2.40.0\"\n```\n\nGet any deleted file:\n\n```php\n$GitInfo-\u003egetDeletedFiles(false);\n// For example: array(2) { [0]=\u003e string(13) \"deleted_1.php\" [1]=\u003e string(13) \"deleted_2.php\" }\n\n$GitInfo-\u003egetDeletedFiles(true);\n// For example: array(2) { [0]=\u003e string(36) \"/Users/antogno/gitinfo/deleted_1.php\" [1]=\u003e string(36) \"/Users/antogno/gitinfo/deleted_2.php\" }\n```\n\nGet any modified file:\n\n```php\n$GitInfo-\u003egetModifiedFiles(false);\n// For example: array(2) { [0]=\u003e string(14) \"modified_1.php\" [1]=\u003e string(14) \"modified_2.php\" }\n\n$GitInfo-\u003egetModifiedFiles(true);\n// For example: array(2) { [0]=\u003e string(37) \"/Users/antogno/gitinfo/modified_1.php\" [1]=\u003e string(37) \"/Users/antogno/gitinfo/modified_2.php\" }\n```\n\nGet any renamed file:\n\n```php\n$GitInfo-\u003egetRenamedFiles(false);\n// For example: array(1) { [\"old_name.php\"]=\u003e string(12) \"new_name.php\" }\n\n$GitInfo-\u003egetRenamedFiles(true);\n// For example: array(1) { [\"/Users/antogno/gitinfo/old_name.php\"]=\u003e string(35) \"/Users/antogno/gitinfo/new_name.php\" }\n```\n\nGet any unmerged file:\n\n```php\n$GitInfo-\u003egetUnmergedFiles(false);\n// For example: array(2) { [0]=\u003e string(14) \"unmerged_1.php\" [1]=\u003e string(14) \"unmerged_2.php\" }\n\n$GitInfo-\u003egetUnmergedFiles(true);\n// For example: array(2) { [0]=\u003e string(37) \"/Users/antogno/gitinfo/unmerged_1.php\" [1]=\u003e string(37) \"/Users/antogno/gitinfo/unmerged_2.php\" }\n```\n\nGet any untracked file:\n\n```php\n$GitInfo-\u003egetUntrackedFiles(false);\n// For example: array(2) { [0]=\u003e string(15) \"untracked_1.php\" [1]=\u003e string(15) \"untracked_2.php\" }\n\n$GitInfo-\u003egetUntrackedFiles(true);\n// For example: array(2) { [0]=\u003e string(38) \"/Users/antogno/gitinfo/untracked_1.php\" [1]=\u003e string(38) \"/Users/antogno/gitinfo/untracked_2.php\" }\n```\n\nGet any staged file:\n\n```php\n$GitInfo-\u003egetStagedFiles(false);\n// For example: array(2) { [0]=\u003e string(12) \"modified.php\" [1]=\u003e string(11) \"deleted.php\" }\n\n$GitInfo-\u003egetStagedFiles(true);\n// For example: array(2) { [0]=\u003e string(35) \"/Users/antogno/gitinfo/modified.php\" [1]=\u003e string(34) \"/Users/antogno/gitinfo/deleted.php\" }\n```\n\nGet any unstaged file:\n\n```php\n$GitInfo-\u003egetUnstagedFiles(false);\n// For example: array(2) { [0]=\u003e string(12) \"modified.php\" [1]=\u003e string(11) \"deleted.php\" }\n\n$GitInfo-\u003egetUnstagedFiles(true);\n// For example: array(2) { [0]=\u003e string(35) \"/Users/antogno/gitinfo/modified.php\" [1]=\u003e string(34) \"/Users/antogno/gitinfo/deleted.php\" }\n```\n\n### Author\n\nWhether the given author exists or not:\n\n```php\n$GitInfo-\u003ehasAuthor('tonio.granaldi@gmail.com', 'antogno');\n// For example: bool(true)\n\n$GitInfo-\u003ehasAuthor('', 'johndoe');\n// For example: bool(false)\n\n$GitInfo-\u003ehasAuthor('TONIO.GRANALDI@GMAIL.COM', 'ANTOGNO');\n// For example: bool(true)\n```\n\nGet the author of the current commit:\n\n```php\n$GitInfo-\u003egetCurrentCommitAuthor();\n```\n\nGet the given author, if exists:\n\n```php\n$GitInfo-\u003egetAuthor('tonio.granaldi@gmail.com', 'antogno');\n\n$GitInfo-\u003egetAuthor('', 'antogno');\n\n$GitInfo-\u003egetAuthor('TONIO.GRANALDI@GMAIL.COM');\n```\n\nGet the authors list:\n\n```php\n$GitInfo-\u003egetAuthors();\n```\n\nEach of the previous three methods returns an [`AuthorResource`](#authorresource) object (or a list of such).\n\n#### `AuthorResource`\n\n```php\nuse antogno\\GitInfo\\Resources\\AuthorResource;\n\n$Author = new AuthorResource('tonio.granaldi@gmail.com', 'antogno');\n\n$Author = new AuthorResource('', 'antogno');\n\n$Author = new AuthorResource('TONIO.GRANALDI@GMAIL.COM');\n```\n\nGet the author name:\n\n```php\n$Author-\u003egetName();\n// For example: string(7) \"antogno\"\n```\n\nGet the author email:\n\n```php\n$Author-\u003egetEmail();\n// For example: string(24) \"tonio.granaldi@gmail.com\"\n```\n\nGet the author commits ([`CommitResource`](#commitresource) list):\n\n```php\n$Author-\u003egetCommits();\n```\n\n### Branch\n\nWhether the given branch exists or not:\n\n```php\n$GitInfo-\u003ehasBranch('master');\n// For example: bool(true)\n\n$GitInfo-\u003ehasBranch('MASTER');\n// For example: bool(false)\n```\n\nGet the current branch:\n\n```php\n$GitInfo-\u003egetCurrentBranch();\n```\n\nGet the given branch, if exists:\n\n```php\n$GitInfo-\u003egetBranch('master');\n```\n\nGet the branches list:\n\n```php\n$GitInfo-\u003egetBranches();\n```\n\nEach of the previous three methods returns a [`BranchResource`](#branchresource) object (or a list of such).\n\n#### `BranchResource`\n\n```php\nuse antogno\\GitInfo\\Resources\\BranchResource;\n\n$Branch = new BranchResource('master');\n```\n\nGet the author name:\n\n```php\n$Branch-\u003egetName();\n// For example: string(6) \"master\"\n```\n\nGet the branch last commit ([`CommitResource`](#commitresource)):\n\n```php\n$Branch-\u003egetLastCommit();\n```\n\n### Commit\n\nWhether a commit with the given hash exists or not:\n\n```php\n$GitInfo-\u003ehasCommit('ed8f9325485f108ddafe3890dc4b13be07aa13cb');\n// For example: bool(true)\n\n$GitInfo-\u003ehasCommit('ed8f932');\n// For example: bool(true)\n```\n\nGet the current commit:\n\n```php\n$GitInfo-\u003egetCurrentCommit();\n```\n\nGet the given commit, if exists:\n\n```php\n$GitInfo-\u003egetCommit('ed8f9325485f108ddafe3890dc4b13be07aa13cb');\n\n$GitInfo-\u003egetCommit('ed8f932');\n```\n\nGet the commits list:\n\n```php\n$GitInfo-\u003egetCommits();\n```\n\nEach of the previous three methods returns a [`CommitResource`](#commitresource) object (or a list of such).\n\n#### `CommitResource`\n\n```php\nuse antogno\\GitInfo\\Resources\\CommitResource;\n\n$Commit = new CommitResource('ed8f9325485f108ddafe3890dc4b13be07aa13cb');\n\n$Commit = new CommitResource('ed8f932');\n```\n\nGet the long commit hash:\n\n```php\n$Commit-\u003egetLongHash();\n// For example: string(40) \"ed8f9325485f108ddafe3890dc4b13be07aa13cb\"\n```\n\nGet the short commit hash:\n\n```php\n$Commit-\u003egetShortHash();\n// For example: string(7) \"ed8f932\"\n```\n\nGet the commit message:\n\n```php\n$Commit-\u003egetMessage();\n// For example: string(14) \"Initial commit\"\n```\n\nGet the commit date (`DateTime`):\n\n```php\n$Commit-\u003egetDate();\n```\n\nGet the commit author ([`AuthorResource`](#authorresource)):\n\n```php\n$Commit-\u003egetAuthor();\n```\n\n### Tag\n\nWhether the given tag exists or not:\n\n```php\n$GitInfo-\u003ehasTag('v1.0.0');\n// For example: bool(true)\n\n$GitInfo-\u003ehasTag('V1.0.0');\n// For example: bool(false)\n```\n\nGet the current tag, if in a tag:\n\n```php\n$GitInfo-\u003egetCurrentTag();\n```\n\nGet the given tag, if exists:\n\n```php\n$GitInfo-\u003egetTag('v1.0.0');\n```\n\nGet the tags list:\n\n```php\n$GitInfo-\u003egetTags();\n```\n\nEach of the previous three methods returns a [`TagResource`](#tagresource) object (or a list of such).\n\n#### `TagResource`\n\n```php\nuse antogno\\GitInfo\\Resources\\TagResource;\n\n$Tag = new TagResource('v1.0.0');\n```\n\nGet the tag name:\n\n```php\n$Tag-\u003egetName();\n// For example: string(6) \"v1.0.0\"\n```\n\nGet the tag last commit ([`CommitResource`](#commitresource)):\n\n```php\n$Tag-\u003egetLastCommit();\n```\n\n### Remote\n\nWhether the given remote exists or not:\n\n```php\n$GitInfo-\u003ehasRemote('origin');\n// For example: bool(true)\n\n$GitInfo-\u003ehasRemote('ORIGIN');\n// For example: bool(false)\n```\n\nGet the remote from which the current branch is tracking:\n\n```php\n$GitInfo-\u003egetCurrentRemote();\n```\n\nGet the given remote, if exists:\n\n```php\n$GitInfo-\u003egetRemote('origin');\n```\n\nGet the remotes list:\n\n```php\n$GitInfo-\u003egetRemotes();\n```\n\nEach of the previous three methods returns a [`RemoteResource`](#remoteresource) object (or a list of such).\n\n#### `RemoteResource`\n\n```php\nuse antogno\\GitInfo\\Resources\\RemoteResource;\n\n$Remote = new RemoteResource('origin');\n```\n\nGet the remote name:\n\n```php\n$Remote-\u003egetName();\n// For example: string(6) \"origin\"\n```\n\nGet the remote URL:\n\n```php\n$Remote-\u003egetUrl();\n// For example: string(38) \"https://github.com/antogno/gitinfo.git\"\n```\n\n## License\n\nGitInfo is licensed under the terms of the [Creative Commons Zero v1.0 Universal license](https://github.com/antogno/gitinfo/blob/master/LICENSE).\n\nFor more information, see the [Creative Commons website](https://creativecommons.org/publicdomain/zero/1.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantogno%2Fgitinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantogno%2Fgitinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantogno%2Fgitinfo/lists"}