PHPackages                             gevman/git-hook - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gevman/git-hook

ActiveProject[API Development](/categories/api)

gevman/git-hook
===============

Git Hook - A php library for handle GitHub and BitBucket webHook events

1.0.1(9y ago)830PHPPHP &gt;=5.4

Since Nov 14Pushed 9y ago2 watchersCompare

[ Source](https://github.com/gevorgmansuryan/GitHook)[ Packagist](https://packagist.org/packages/gevman/git-hook)[ RSS](/packages/gevman-git-hook/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Git Hook
========

[](#git-hook)

works with GitHub and BitBucket webHooks

Installation (using composer)
-----------------------------

[](#installation-using-composer)

```
composer require gevman/git-hook
```

### GitHub Events (for more info take a look at [Official GitHub Documentation](https://developer.github.com/webhooks/))

[](#github-events-for-more-info-take-a-look-at-official-github-documentation)

- `onCommitComment` - Commit or diff commented on.
- `onCreate` - Branch or tag created.
- `onDelete` - Branch or tag deleted.
- `onDeployment` - Repository deployed.
- `onDeploymentStatus` - Deployment status updated from the API.
- `onFork` - Repository forked.
- `onGollum` - Wiki page updated.
- `onIssueComment` - Issue comment created, edited, or deleted.
- `onIssues` - Issue opened, edited, closed, reopened, assigned, unassigned, labeled, unlabeled, milestoned, or demilestoned.
- `onLabel` - Label created or deleted.
- `onMember` - Collaborator added to a repository.
- `onMilestone` - Milestone created, closed, opened, edited, or deleted.
- `onPageBuild` - Pages site built.
- `onPrivateToPublic` - Repository changes from private to public.
- `onPullRequest` - Pull request opened, closed, reopened, edited, assigned, unassigned, labeled, unlabeled, or synchronized.
- `onPullRequestReview` - Pull request review submitted.
- `onPullRequestReviewComment` - Pull request diff comment created, edited, or deleted.
- `onPush` - Git push to a repository.
- `onRelease` - Release published in a repository.
- `onStatus` - Commit status updated from the API.
- `onTeamAdd` - Team added or modified on a repository.
- `onWatch` - User stars a repository.

#### Examples

[](#examples)

###### Example #1

[](#example-1)

automatically `git pull` on your server after every push

```
require __DIR__.'/vendor/autoload.php';

$gitHubRepo = new \Gevman\GitHook\GitHub\Repository();

$gitHubRepo->onPush(function() {
    exec('cd /path/to/your/project && git pull');
});
```

###### Example #2

[](#example-2)

notify your team in Slack about `Pull request`

(I suggest use [gevman/slack-bot](https://packagist.org/packages/gevman/slack-bot) ☺)

```
require __DIR__.'/vendor/autoload.php';

$gitHubRepo = new \Gevman\GitHook\GitHub\Repository();
$slackBot = new \Gevman\SlackBot\IncomingBot('YOUR_SLACK_HOOK_URL');

$gitHubRepo->onPullRequest(function($payload) use ($slackBot) {
    $message = sprintf(
        '%s just %s pull request: `%s`',
        $payload['pull_request']['user']['login'],
        $payload['action'],
        $payload['pull_request']['title']
    );

    $slackBot->send($message)
        ->withIcon('https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png')
        ->to('general');
});
```

### BitBucket Events (for more info take a look at [Official BitBucket Documentation](https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html))

[](#bitbucket-events-for-more-info-take-a-look-at-official-bitbucket-documentation)

- `onPush` - A user pushes 1 or more commits to a repository.
- `onFork` - A user forks a repository.
- `onUpdated` - A user updates the Name, Description, Website, or Language fields under the Repository details page of the repository settings.
- `onCommitCommentCreated` - A user comments on a commit in a repository.
- `onBuildStatusCreated` - A build system, CI tool, or another vendor recognizes that a user recently pushed a commit and updates the commit with its status.
- `onBuildStatusUpdated` - A build system, CI tool, or another vendor recognizes that a commit has a new status and updates the commit with its status.
- `onIssueCreated` - A user creates an issue for a repository.
- `onIssueUpdated` - A user updated an issue for a repository.
- `onIssueCommentCreated` - A user comments on an issue associated with a repository.
- `onPullRequestCreated` - A user creates a pull request for a repository.
- `onPullRequestUpdated` - A user updates a pull request for a repository.
- `onPullRequestApproved` - A user approves a pull request for a repository.
- `onPullRequestApprovalRemoved` - A user removes an approval from a pull request for a repository.
- `onPullRequestMerged` - A user merges a pull request for a repository.
- `onPullRequestDeclined` - A user declines a pull request for a repository.
- `onPullRequestCommentCreated` - A user comments on a pull request.
- `onPullRequestCommentUpdated` - A user updates a comment on a pull request.
- `onPullRequestCommentDeleted` - A user deletes a comment on a pull request.

#### Examples

[](#examples-1)

###### Example #1

[](#example-1-1)

automatically `git pull` on your server after every push

```
require __DIR__.'/vendor/autoload.php';

$bitBucketRepo = new \Gevman\GitHook\BitBucket\Repository();

$bitBucketRepo->onPush(function() {
    exec('cd /path/to/your/project && git pull');
});
```

###### Example #2

[](#example-2-1)

notify your team in Slack about `Pull request`

(I suggest use [gevman/slack-bot](https://packagist.org/packages/gevman/slack-bot) ☺)

```
require __DIR__.'/vendor/autoload.php';

$bitBucketRepo = new \Gevman\GitHook\BitBucket\Repository();
$slackBot = new \Gevman\SlackBot\IncomingBot('YOUR_SLACK_HOOK_URL');

$notifier = function($action) use ($slackBot) {
    return function($payload) use ($action, $slackBot) {
        $message = sprintf(
            '%s just %s pull request: `%s`',
            $payload['actor']['display_name'],
            $action,
            $payload['pullrequest']['title']
        );
        $slackBot->send($message)
            ->withIcon('https://wac-cdn.atlassian.com/assets/img/icons/logo/bitbucket_rgb_blue.svg')
            ->to('general');
    };
};

$bitBucketRepo->onPullRequestApproved($notifier('Approved'))
    ->onPullRequestApprovalRemoved($notifier('ApprovalRemoved'))
    ->onPullRequestCreated($notifier('Created'))
    ->onPullRequestMerged($notifier('Merged'))
    ->onPullRequestUpdated($notifier('Updated'));
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

2

Last Release

3460d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11891855?v=4)[Gevorg Mansuryan](/maintainers/gevorgmansuryan)[@gevorgmansuryan](https://github.com/gevorgmansuryan)

---

Top Contributors

[![gevorgmansuryan](https://avatars.githubusercontent.com/u/11891855?v=4)](https://github.com/gevorgmansuryan "gevorgmansuryan (8 commits)")

### Embed Badge

![Health badge](/badges/gevman-git-hook/health.svg)

```
[![Health](https://phpackages.com/badges/gevman-git-hook/health.svg)](https://phpackages.com/packages/gevman-git-hook)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
