{"id":15365954,"url":"https://github.com/andywer/php-easygit","last_synced_at":"2025-04-15T10:51:15.857Z","repository":{"id":10115032,"uuid":"12182028","full_name":"andywer/php-easygit","owner":"andywer","description":"Manage Git repositories from within your PHP webapp. Commit, branch, clone, checkout, ...","archived":false,"fork":false,"pushed_at":"2016-07-14T12:21:32.000Z","size":12,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T19:13:10.383Z","etag":null,"topics":[],"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/andywer.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":"2013-08-17T16:47:11.000Z","updated_at":"2023-07-14T09:09:08.000Z","dependencies_parsed_at":"2022-09-14T17:11:46.644Z","dependency_job_id":null,"html_url":"https://github.com/andywer/php-easygit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andywer%2Fphp-easygit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andywer%2Fphp-easygit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andywer%2Fphp-easygit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andywer%2Fphp-easygit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andywer","download_url":"https://codeload.github.com/andywer/php-easygit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249057567,"owners_count":21205904,"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":[],"created_at":"2024-10-01T13:16:48.105Z","updated_at":"2025-04-15T10:51:15.828Z","avatar_url":"https://github.com/andywer.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-easygit [![Build Status](https://travis-ci.org/andywer/php-easygit.png?branch=master)](https://travis-ci.org/andywer/php-easygit) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/andywer/php-easygit/badges/quality-score.png?s=841fe3e93fbf3f293b08de04e86e6b6179d55fd0)](https://scrutinizer-ci.com/g/andywer/php-easygit/)\n\nManage Git repositories from within your PHP webapp. No further dependencies. You just need to have PHP 5.3+ and Git installed.\n\nThis library is a PHP wrapper around the Git command line tool. You may open, create or clone repositories, get information about it and execute any Git command.\n\n\n## Installation\n\nTo install the library you just need to clone the repository (or add EasyGit as submodule):\n\n```sh\ngit clone https://github.com/andywer/php-easygit.git\n```\n\nOr use composer to use EasyGit in your project. Create the following composer.json:\n\n```json\n{\n  \"require\" : {\n    \"easygit/easygit\" : \"dev-master\"\n  }\n}\n```\n\nAnd then execute `composer install`. Just add `require_once \"vendor/autoload.php\";` to your PHP source code.\n\nDone!\n\n\n## Usage\n\n\n```php\n\u003c?php\n\nrequire_once 'vendor/easygit/easygit/EasyGit.php';\n\nuse \\EasyGit\\Repository;\n\n// Open an existing git repository\n$repo = Repository::open(\"path/to/repository\");\n\n// Create a new empty git repository\n$repo = Repository::create(\"path/to/repository\");\n\n// Create a new git repository by cloning one\n$repo = Repository::cloneFromUrl(\"https://github.com/vendor/project.git\", \"path/to/repository\");\n\n// Get the current branch\necho \"Current branch: \" . $repo-\u003egetCurrentBranch() . \"\\n\";\n\n// Get all branches\necho \"Branches: \" . implode(\",\", $repo-\u003egetBranches()) . \"\\n\";\n\n// Get all tags\necho \"Tags: \" . implode(\",\", $repo-\u003egetTags()) . \"\\n\";\n\n// Print the output of `git status`\necho $repo-\u003egit(\"status\") . \"\\n\";\n\n// The library will raise an exception and provide a useful error message if git encounters an error\necho $repo-\u003egit(\"checkout branch-that-does-not-exist\") . \"\\n\";\n\n/* Output:\n * PHP Fatal error:  Uncaught exception 'EasyGit\\GitException' with message 'Git invocation failed:\n * git 'checkout' 'branch-that-does-not-exist'. Error: error: pathspec 'branch-that-does-not-exist'\n * did not match any file(s) known to git.' in /tmp/easygit/vendor/easygit/easygit/lib/EasyGit/Command.php:25\n * Stack trace:\n * #0 /tmp/easygit-test/vendor/easygit/easygit/lib/EasyGit/Repository.php(93): EasyGit\\Command-\u003erun()\n * #1 /tmp/easygit-test/test.php(4): EasyGit\\Repository-\u003egit('checkout branch...')\n * #2 {main}\n *   thrown in /tmp/easygit-test/vendor/easygit/easygit/lib/EasyGit/Command.php on line 25\n */\n\n?\u003e\n```\n\n\n## PHP Git Repo\n\nEasyGit is quite similar to [PHP Git Repo](https://github.com/ornicar/php-git-repo).\nI wrote the EasyGit library since I soon struggled with its limited error handling capabilities and very basic git command invocation using _passthru()_.\n_PHP Git Repo_ is quite customizable, but I wanted to have a out-of-the-box solution that suites my needs. It will also be used in a professional environment and I can ensure the neccessary quality of support for my own library.\n\nNo offense!\n\n\n## Development\n\nFeel free to submit your issues and feature requests. You can also participate in the development progress.\n\nIf you want to run the tests, you will need to install the atoum unit test library. Just install composer and run it:\n\n```sh\n./sh/install-composer.sh\nphp composer.phar install\n```\n\nTests can be run by executing `./sh/run-tests.sh`.\n\n\n## License\n\nThis library is published under the MIT license. See [license](https://raw.github.com/andywer/php-easygit/master/LICENSE) for details.\n\nHave a lot of fun!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandywer%2Fphp-easygit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandywer%2Fphp-easygit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandywer%2Fphp-easygit/lists"}