PHP code example of astrotomic / laravel-github-sponsors

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

    

astrotomic / laravel-github-sponsors example snippets


$this->app->when(\Astrotomic\GithubSponsors\Graphql::class)
    ->needs('$token')
    ->give('my_custom_secret');

use Astrotomic\GithubSponsors\Facades\GithubSponsors;

// all sponsors for current authenticated user
GithubSponsors::viewer()->sponsors();
// all sponsors for given name without knowing what it is
GithubSponsors::login('larabelles')->sponsors();
// all sponsors for given user
GithubSponsors::user('Gummibeer')->sponsors();
// all sponsors for given organization
GithubSponsors::organization('Astrotomic')->sponsors();

// select specific attributes
GithubSponsors::viewer()->sponsors(['login', 'name', 'avatarUrl']);
// select specific attributes and company only for users
GithubSponsors::viewer()->sponsors(['login', 'name', 'avatarUrl'], ['company']);
// select specific attributes and email only for organizations
GithubSponsors::viewer()->sponsors(['login', 'name', 'avatarUrl'], [], ['email']);

// check if viewer sponsored by Gummibeer
GithubSponsors::viewer()->isSponsoredBy('Gummibeer');
// check if viewer sponsors Gummibeer
GithubSponsors::viewer()->isSponsoring('Gummibeer');
// check if viewer has sponsors
GithubSponsors::viewer()->hasSponsors();
// check how many sponsors the viewer has
GithubSponsors::viewer()->sponsorsCount();