Download the PHP package love-oss/github-event-parser without Composer
On this page you can find all versions of the php package love-oss/github-event-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download love-oss/github-event-parser
More information about love-oss/github-event-parser
Files in love-oss/github-event-parser
Package github-event-parser
Short Description PHP library to get a readable representation of events dispatched by Github API v3
License MIT
Homepage https://github.com/loveOSS/github-event-parser
Informations about the package github-event-parser
Github event parser library
This library is a reupload of a library created by Mickaël Andrieu in 2016 for the Lp Digital web agency, Paris, France. We have obtained the authorization from the former creator to change the licence from GNU-GPL v2 to MIT. PHP Developers : consider using love-oss/github-event-parser as a direct replacement of lp-digital/github-event-parser.
Github Event Parser is a naive PHP library aimed to provide readable representations of json responses from Github Events Api v3.
Thanks to the Github webhooks, any administrator of a repository can access and listen theses events returned into json responses.
The only aim of this library is to parse theses responses, and create simple POPO (Plain Old PHP Object) easy to manipulate, extends or even persist in a database.
A lot of usages are available since you can listen all events:
- make statistics on your repositories
- do some tasks after a successful deployment
- send a "thanks" email for each validated contribution
- and so on ...
Installation
PHP requirements
The library may access to GitHub API to retrieve additional information.
Your PHP configuration may have allow_url_fopen
and a valid user_agent
enabled, or
some informations won't be retrieved.
You can use InvalidPhpConfigurationException
to catch the exception:
How to resolve a json response from Github ?
Once your webhook is set up, you should receive POST responses from github each time an event is dispatched by the platform.
For instance, let's consider you have a simple github-hook.php
file and have installed your dependency through composer:
EventTypes
Note that this library is not complete, so only few events are available for now. But, it's realy easy to implement the missing. If you need them, please make a pull request!
IssueCommentEvent
Dispatched when someone comment an issue
You can retrieve the issue, the user and the related comment from this event.
IssuesEvent
Dispatched when an issue is assigned, unassigned, labeled, unlabeled, opened, closed, or reopened.
You can retrieve the action, the repository and the sender from this event. When available, you can also get assignee and label.
ForkEvent
Dispatched when someone fork the repository
You can retrieve the forked repository, the owner, the new repository and the "forker".
DeploymentStatusEvent
Dispatched when a deployement's status changes
You can retrieve the deployment, the sender and the related repository.
PullRequestEvent
Dispatched when a pull request is assigned, unassigned, labeled, unlabeled, opened, closed, reopened, or synchronized.
PushEvent
Dispatched when a repository branch is pushed to. In addition to branch pushes, webhook push events are also triggered when repository tags are pushed.
StatusEvent
Dispatched when the status of a Git commit changes. Events of this type are not visible in timelines, they are only used to trigger hooks.
You can retrieve the sha, the status, the committer and the related repository. More others informations are available.
WatchEvent
The WatchEvent is related to starring a repository, not watching. See this API blog post for an explanation. The event’s actor is the user who starred a repository, and the event’s repository is the repository that was starred.
PullRequestReviewCommentEvent
Dispatched when a comment is created on a portion of the unified diff of a pull request.
GollumEvent
Dispatched when a Wiki page is created or updated.
Entities
Each object from Github API have his PHP class.
- Comment
- Commit (and CommitUser)
- Deployment
- Issue
- Label
- Page (Wiki)
- PullRequest
- Release
- Repository
- User
Roadmap
- Improve and monitor the quality of this library
- Add the missing missing events
- Add doctrine mapping file for doctrine/dbal
How to contribute ?
All features are tested, and all contributions need to be tested in order to be accepted.
Features from roadmap and bug fixes are prioritized. Fork the repository, create a feature branch and then launch the testsuite:
Thank you for help, let us know if you use this library ;)