PHP code example of norman-huth / github-api

1. Go to this page and download the library: Download norman-huth/github-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

norman-huth / github-api example snippets




use NormanHuth\GithubApi\Client;

E}');

$response = $client->repos()->reposCreateAFork(
    owner: 'Muetze42',
    repo: 'github-api',
    requestBody: ['organization' => 'MyVendor', 'name' => 'MyRepo']
);

// Get data as array
return $response->json()
// Get data as object
return $response->object()
// More infos: https://laravel.com/docs/http-client#making-requests



if ($response->successful()) {
    return $response->json();
}



$client->whoami();



$client->userRepositories();



$client->userGists();



$client->userIssues();



$client->userNotifications();



$client->userOrganizationIssues();



$client->userRepositoryNotifications();