Overview

Classes

  • gitCurl
  • Overview
  • Class

Class gitCurl

GitCurl Documentation

GitHub API Helper for PHP 5.3+

A PHP class that makes it easy to help you embed commits, issues and milestones on your website.

Copyright: 2018
License: https://opensource.org/licenses/MIT
Author: Daniel Retzl
Link: http://gitcurl.yawk.io/
Located at gitCurl.class.php
Methods summary
public
# isInstalled( )

Check if cURL is installed and call init method. If cURL is not installed, abort with error message.

Check if cURL is installed and call init method. If cURL is not installed, abort with error message.

public string
# setRepository( string $apiURL )

Set a user defined repository. Expects a correct API URL.

Set a user defined repository. Expects a correct API URL.

Parameters

$apiURL
the API URL string

Returns

string
public boolean
# initCurl( string $apiURL )

Init curl get curl handle for this repository. Expects a correct API URL.

Init curl get curl handle for this repository. Expects a correct API URL.

Parameters

$apiURL
the API URL string

Returns

boolean
return true if curl_init was successful.
public
# setOpts( )

Set Curl Options

Set Curl Options

public
# exeCurl( )

Execute cURL handle

Execute cURL handle

public
# closeCurl( )

Close this cURL handle

Close this cURL handle

public
# json2Array( )

Convert jSON string into multi-dimensional array

Convert jSON string into multi-dimensional array

public
# output( )

Basic output of data array

Basic output of data array

public array
# getData( string $apiURL )

Get Data from GitHub. This method set the repository, execute curl and return data as array.

Get Data from GitHub. This method set the repository, execute curl and return data as array.

Parameters

$apiURL
the API URL string

Returns

array
return data array
public string
# daysAgo( string $itemDate )

Calculate difference between two dates. Expect itemDate as string. Return how many days ago as string.

Calculate difference between two dates. Expect itemDate as string. Return how many days ago as string.

Parameters

$itemDate
the item date as string

Returns

string
return how many days have been gone.
public mixed
# replaceIssueWithLink( string $commitMessage )

If a commit contains a string like 'issue #123', the hashtag will be converted to a link which leads to this issue on GitHub.

If a commit contains a string like 'issue #123', the hashtag will be converted to a link which leads to this issue on GitHub.

Parameters

$commitMessage
The commit message as string

Returns

mixed
return false, if no commit msg was set or commit message containing link, or just the commit message if no #int was found.
public array
# drawCommits( array $data )

Draw commits with bootstrap card style

Draw commits with bootstrap card style

Parameters

$data
Array

Returns

array
return data array
public
# getLabels( array $data )

Draw labels that are used in this element. Expects data array

Draw labels that are used in this element. Expects data array

Parameters

$data
Array containing the data
public string
# getIconFor( string $state )

Check open/closed state and draw appropriate icon.

Check open/closed state and draw appropriate icon.

Parameters

$state
Status of this element (open or closed)

Returns

string
html code (icon)
public
# drawIssues( array $data )

Draw Issues with bootstrap card style. Expects data array

Draw Issues with bootstrap card style. Expects data array

Parameters

$data
Array containing the data
public
# printData( array $data )

Basic output of data array (for testing purpose)

Basic output of data array (for testing purpose)

Parameters

$data
Array containing the data
Properties summary
public string $username

GitHub username

GitHub username

# 'username'
public string $password

GitHub password

GitHub password

# 'password'
public string $userAgent

User Agent String

User Agent String

# ''
public string $projectName

Project name that will be displayed in heading

Project name that will be displayed in heading

# "yawk.io"
public string $projectUrl

GitHub project URL

GitHub project URL

# "https://github.com/YaWK/yawk.io/"
public string $masterZip

Link to the master zip file on GitHub

Link to the master zip file on GitHub

# "https://github.com/YaWK/yawk.io/archive/master.zip"
public string $apiURL

GitHub API Link (your request)

GitHub API Link (your request)

# 'https://api.github.com/repos/YaWK/yawk.io/milestones?state=open'
public string $state

Which state should be loaded on default

Which state should be loaded on default

# 'closed'
public boolean $authentication

True, if repository needs authentication

True, if repository needs authentication

# true
public boolean $custom

True, if user loads a custom repository

True, if user loads a custom repository

# false
public string $curl

Holds the cURL handle

Holds the cURL handle

# ''
public string $result

API result as json string

API result as json string

# ''
public array $data

API result as array

API result as array

# array()
API documentation generated by ApiGen