PHP code example of jeffersongoncalves / laravel-github-contributions

1. Go to this page and download the library: Download jeffersongoncalves/laravel-github-contributions 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/ */

    

jeffersongoncalves / laravel-github-contributions example snippets


// config/github-contributions.php
return [
    // Falls back to config('services.github.token') when empty.
    'token' => env('GITHUB_TOKEN'),

    'user_agent' => env('GITHUB_CONTRIBUTIONS_USER_AGENT', 'laravel-github-contributions'),

    'timeout' => (int) env('GITHUB_CONTRIBUTIONS_TIMEOUT', 8),

    // Cache responses (keyed by login) to stay under the 5000/hr API limit.
    // Set ttl to 0 to disable caching entirely.
    'cache' => [
        'ttl' => (int) env('GITHUB_CONTRIBUTIONS_CACHE_TTL', 3600),
    ],
];

use JeffersonGoncalves\GitHubContributions\GitHubContributions;

$data = GitHubContributions::fetch('jeffersongoncalves');

// [
//     'cells' => [0, 1, 0, 2, 4, 3, 0, ...], // list<int 0-4>, 7 per week, column-major
//     'total' => 1234,                        // total contributions in the calendar window
// ]
bash
php artisan vendor:publish --tag="laravel-github-contributions-config"
bash
composer analyse