{"id":18525541,"url":"https://github.com/zero-24/php-gitdeploy-script","last_synced_at":"2025-11-01T00:30:23.379Z","repository":{"id":251315263,"uuid":"835878860","full_name":"zero-24/php-gitdeploy-script","owner":"zero-24","description":"Automatically deploy code using PHP and Git.","archived":false,"fork":false,"pushed_at":"2024-08-06T15:11:02.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-26T00:43:55.335Z","etag":null,"topics":["deployment","git","git-webhook","php"],"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/zero-24.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":"2024-07-30T17:51:49.000Z","updated_at":"2024-08-06T15:11:05.000Z","dependencies_parsed_at":"2024-11-06T17:59:54.460Z","dependency_job_id":null,"html_url":"https://github.com/zero-24/php-gitdeploy-script","commit_stats":null,"previous_names":["zero-24/php-gitdeploy-script"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-24%2Fphp-gitdeploy-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-24%2Fphp-gitdeploy-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-24%2Fphp-gitdeploy-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-24%2Fphp-gitdeploy-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zero-24","download_url":"https://codeload.github.com/zero-24/php-gitdeploy-script/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239242067,"owners_count":19605946,"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":["deployment","git","git-webhook","php"],"created_at":"2024-11-06T17:46:16.366Z","updated_at":"2025-11-01T00:30:23.340Z","avatar_url":"https://github.com/zero-24.png","language":"PHP","readme":"# php-gitdeploy-script\n_Automatically deploy code using PHP and Git._\n\nThis script is largly based on [https://github.com/markomarkovic/simple-php-git-deploy/tree/1.3.1](markomarkovic/simple-php-git-deploy) version 1.3.1 but modified for my usecases\n\n## Requirements\n\n* `git` and `rsync` are required on the server that's running the script\n  (_server machine_).\n  - Optionally, `tar` is required for backup functionality (`BACKUP_DIR` option).\n  - Optionally, `composer` is required for composer functionality (`USE_COMPOSER`\n  option).\n* The system user running PHP (e.g. `www-data`) needs to have the necessary\n  access permissions for the `TMP_DIR` and `TARGET_DIR` locations on\n  the _server machine_.\n* If the Git repository you wish to deploy is private, the system user running PHP\n  also needs to have the right SSH keys to access the remote repository.\n\n## Usage\n\n * Configure the script and put it somewhere that's accessible from the\n   Internet. The preferred way to configure it is to use `deploy-config.php` file.\n   Rename `deploy-config.example.php` to `deploy-config.php` and edit the\n   configuration options there. That way, you won't have to edit the configuration\n   again if you download the new version of `deploy.php`.\n * Configure your git repository to call this script when the code is updated.\n   The instructions for GitHub and Bitbucket are below.\n\n### GitHub\n\n- _(This step is only needed for private repositories)_ Go to\n    `https://github.com/USERNAME/REPOSITORY/settings/keys` and add your server\n    SSH key.\n- Go to `https://github.com/USERNAME/REPOSITORY/settings/hooks`.\n- Click **Add webhook** in the **Webhooks** panel.\n- Enter the **Payload URL** for your deployment script e.g. `https://example.com/deploy.php`.\n- Configure the option **Content type** with `application/x-www-from-urlencoded`.\n- Add the value from `SECRET_ACCESS_TOKEN` as to the field **Secret**.\n- _Optional_ Choose which events should trigger the deployment usually thats just `push`.\n- Make sure that the **Active** checkbox is checked.\n- Click **Add webhook**.\n\n## Done!\n\nNext time you push the code to the repository that has a hook enabled, it's\ngoing to trigger the `deploy.php` script which is going to pull the changes and\nupdate the code on the _server machine_.\n\nFor more info, read the source of `deploy.php`.\n\n## Tips'n'Tricks\n\n * Because `rsync` is used for deployment, the `TARGET_DIR` doesn't have to be\n   on the same server that the script is running e.g. `define('TARGET_DIR',\n   'username@example.com:/full/path/to/target_dir/');` is going to work as long\n   as the user has the right SSH keys and access permissions.\n * You can have multiple scripts with different configurations. Simply rename\n   the `deploy.php` to something else, for example `deploy_master.php` and\n   `deploy_develop.php` and configure them separately. In that case, the\n   configuration files need to be named `deploy_master-config.php` and\n   `deploy_develop-config.php` respectively.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-24%2Fphp-gitdeploy-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzero-24%2Fphp-gitdeploy-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-24%2Fphp-gitdeploy-script/lists"}