Download the PHP package ornicar/github-api without Composer

On this page you can find all versions of the php package ornicar/github-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package github-api

Deprecated. The development has moved to github.com/KnpLabs/php-github-api


PHP GitHub API

A simple Object Oriented wrapper for GitHub API, written with PHP5.

Uses GitHub API v2. The object API is very similar to the RESTful API.

Features

Requirements

Autoload

The first step to use php-github-api is to register its autoloader:

Replace the /path/to/lib/ path with the path you used for php-github-api installation.

php-github-api follows the PEAR convention names for its classes, which means you can easily integrate php-github-api classes loading in your own autoloader.

instantiate a new github client

From this object, you can access to all GitHub apis, listed below.

Navigation

Run Test Suite

Users

Go back to the Navigation

Searching users, getting user information and managing authenticated user account information. Wrap GitHub User API.

Search for users by username

Returns an array of users.

Get information about a user

Returns an array of information about the user.

Update user informations

Change user attributes: name, email, blog, company, location. Requires authentication.

Returns an array of information about the user.

Get users that a specific user is following

Returns an array of followed users.

Get users following a specific user

Returns an array of following users.

Follow a user

Make the authenticated user follow a user. Requires authentication.

Returns an array of followed users.

Unfollow a user

Make the authenticated user unfollow a user. Requires authentication.

Returns an array of followed users.

Get repos that a specific user is watching

Returns an array of watched repos.

Get the authenticated user emails

Returns an array of the authenticated user emails. Requires authentication.

Add an email to the authenticated user

Returns an array of the authenticated user emails. Requires authentication.

Remove an email from the authenticated user

Return an array of the authenticated user emails. Requires authentication.

Issues

Go back to the Navigation

Listing issues, searching, editing and closing your projects issues. Wrap GitHub Issue API.

List issues in a project

Returns an array of issues.

Search issues in a project

Returns an array of closed issues matching the "bug" term,.

Get information about an issue

Returns an array of information about the issue.

Open a new issue

Creates a new issue in the repo "php-github-api" of the user "ornicar". The issue is assigned to the authenticated user. Requires authentication. Returns an array of information about the issue.

Close an issue

Closes the fourth issue of the repo "php-github-api" of the user "ornicar". Requires authentication. Returns an array of information about the issue.

Reopen an issue

Reopens the fourth issue of the repo "php-github-api" of the user "ornicar". Requires authentication. Returns an array of information about the issue.

Update an issue

Updates the fourth issue of the repo "php-github-api" of the user "ornicar". Requires authentication. Available attributes are title and body. Returns an array of information about the issue.

List an issue comments

List an issue comments by username, repo and issue number. Returns an array of issues.

Add a comment on an issue

Add a comment to the issue by username, repo and issue number. The comment is assigned to the authenticated user. Requires authentication.

List project labels

List all project labels by username and repo. Returns an array of project labels.

Add a label on an issue

Add a label to the issue by username, repo, label name and issue number. Requires authentication. If the label is not yet in the system, it will be created. Returns an array of the issue labels.

Remove a label from an issue

Remove a label from the issue by username, repo, label name and issue number. Requires authentication. Returns an array of the issue labels.

Search issues matching a label

Returns an array of issues matching the given label.

Commits

Go back to the Navigation

Getting information on specific commits, the diffs they introduce, the files they've changed. Wrap GitHub Commit API.

List commits in a branch

Returns an array of commits.

List commits for a file

Returns an array of commits.

Get a single commit

Returns a single commit.

Objects

Go back to the Navigation

Getting full versions of specific files and trees in your Git repositories. Wrap GitHub objects API.

List contents of a tree

Returns an array containing a tree of the repository.

List all blobs of a tree

Returns an array containing the tree blobs.

Show the informations of a blob

Returns array of blob informations.

Show the raw content of an object

The last parameter can be either a blob SHA1, a tree SHA1 or a commit SHA1. Returns the raw text content of the object.

Repos

Go back to the Navigation

Searching repositories, getting repository information and managing repository information for authenticated users. Wrap GitHub Repo API. All methods are described on that page.

Search repos by keyword

Simple search

Returns a list of repositories.

Advanced search

You can filter the results by language. It takes the same values as the language drop down on http://github.com/search.

You can specify the page number:

Get extended information about a repository

Returns an array of information about the specified repository.

Get the repositories of a specific user

Returns a list of repositories.

Get the repositories the authenticated user can push to

Returns a list of repositories.

Create a repository

Creates and returns a public repository named my-new-repo.

Update a repository

The value array also accepts the parameters

Updates and returns the repository named 'my-new-repo' that is owned by 'username'.

Delete a repository

Deletes the my-new-repo repository.

Making a repository public or private

Makes the 'reponame' repository public or private and returns the repository.

Get the deploy keys of a repository

Returns a list of the deploy keys for the 'reponame' repository.

Add a deploy key to a repository

Adds a key with title 'key title' to the 'reponame' repository and returns a list of the deploy keys for the repository.

Remove a deploy key from a repository

Removes the key with id 12345 from the 'reponame' repository and returns a list of the deploy keys for the repository.

Get the collaborators for a repository

Returns a list of the collaborators for the 'reponame' repository.

Add a collaborator to a repository

Adds the 'username' user as collaborator to the 'reponame' repository.

Remove a collaborator from a repository

Remove the 'username' collaborator from the 'reponame' repository.

Watch and unwatch a repository

Watches or unwatches the 'php-github-api' repository owned by 'ornicar' and returns the repository.

Fork a repository

Creates a fork of the 'php-github-api' owned by 'ornicar' and returns the newly created repository.

Get the tags of a repository

Returns a list of tags.

Get the branches of a repository

Returns a list of branches.

Get the watchers of a repository

Returns list of the users watching the 'php-github-api' owned by 'ornicar'.

Get the network (forks) of a repository

Returns list of the forks of the 'php-github-api' owned by 'ornicar', including the original repository.

Get the languages for a repository

Returns a list of languages.

Get the contributors of a repository

Returns a list of contributors.

To include non GitHub users, add a third parameter to true:

Pull Requests

Go back to the Navigation

Lets you list pull requests for a given repository, list one pull request in particular along with its discussion, and create a pull-request. Wraps GitHub Pull Request API, still tagged BETA. All methods are described there.

List all pull requests, per repository

List open pull requests

The last parameter of the listPullRequests method default to 'open'. The call above is equivalent to :

$openPullRequests contains an array of open pull-requests for this repository.

List closed pull requests

$closedPullRequests contains an array of closed pull-requests for this repository.

List one pull request in particular, along with its discussion

The last parameter of this call, Pull request ID, can be either extracted from the results of the listPullRequests results ( 'number' key for a listed pull-request ), or added manually.

The $pullRequest15 array contains the same elements as every entry in the result of a listPullRequests call, plus a "discussion" key, self-explanatory.

Create a pull request

A pull request can either be created by supplying both the Title & Body, OR an Issue ID. Details regarding the content of parameters 3 and 4 of the create method are presented here : http://develop.github.com/p/pulls.html .

Populated with Title and Body

Requires authentication.

This returns the details of the pull request.

Populated with Issue ID

Requires authentication. The issue ID is provided instead of title and body.

This returns the details of the pull request.

Request any Route

Go back to the Navigation

The method you need does not exist yet? You can access any GitHub route by using the "get" and "post" methods. For example,

Returns an array describing the php-github-api repository.

See all GitHub API routes: http://develop.github.com/

Authentication & Security

Go back to the Navigation

Most GitHub services do not require authentication, but some do. For example the methods that allow you to change properties on Repositories and some others. Therefore this step is facultative.

Authenticate

GitHub provides some different ways of authentication. This API implementation implements three of them which are handled by one function:

$username is, of course, the username. $method is optional. The three allowed values are:

The required value of $secret depends on the choosen $method. For the AUTH_*_TOKEN methods, you should provide the API token here. For the AUTH_HTTP_PASSWORD, you should provide the password of the account.

After executing the $github->authenticate($username, $secret, $method); method using correct credentials, all further requests are done as the given user.

About authentication methods

The Github_Client::AUTH_URL_TOKEN authentication method sends the username and API token in URL parameters. The Github_Client::AUTHHTTP* authentication methods send their values to GitHub using HTTP Basic Authentication. Github_Client::AUTH_URL_TOKEN used to be the only available authentication method. To prevent existing applications from changing their behavior in case of an API upgrade, this method is choosen as the default for this API implementation. Note however that GitHub describes this method as deprecated. In most case you should use the Github_Client::AUTH_HTTP_TOKEN instead.

Deauthenticate

If you want to stop new requests from being authenticated, you can use the deAuthenticate method.

Customize php-github-api

Go back to the Navigation

The library is highly configurable and extensible thanks to dependency injection.

Configure the http client

Wanna change, let's say, the http client User Agent?

See all available options in Github/HttpClient.php

Inject a new http client instance

php-github-api provides a curl-based implementation of a http client. If you want to use your own http client implementation, inject it to the Github_Client instance:

Your http client implementation may not extend Github_HttpClient, but only implement Github_HttpClientInterface.

You can now inject your http client through Github_Client constructor:

Or to an existing Github_Client instance:

Inject a new API part instance

If you want to use your own implementation of an API, inject it to the GitHubApi. For example, to replace the user API:

Run Test Suite

Go back to the Navigation

The code is unit tested. To run tests on your machine, from a CLI, run

phpunit

Credits

This library borrows ideas, code and tests from phptwitterbot.

Contributors hall of fame

Thanks to GitHub for the high quality API and documentation.


All versions of github-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ornicar/github-api contains the following files

Loading the files please wait ....