PHP code example of nahid / php-stack-api

1. Go to this page and download the library: Download nahid/php-stack-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/ */

    

nahid / php-stack-api example snippets


return [
    'client_id' => 1234,
    'client_secret' => 'application-client-secret',
    'key' => 'application-key-value',
    'redirect_uri' => 'http://example.com/redirect-uri',
];



use Nahid\StackApis\StackApi;

$config = [
    'client_id' => 1234,
    'client_secret' => 'application-client-secret',
    'key' => 'application-key-value',
    'redirect_uri' => 'http://example.com/redirect-uri',
];
$stackApi = new StackApi($config);

<a href="<?= get_stack_api_auth_url(); 

$me = StackApi::me()->get();

$stackApi = new StackApi($config);
$me = $stackApi->me()->get();

$me = StackApi::users(1234)->get();

$stackApi = new StackApi($config);
$me = $stackApi->users(1234)->get();

$data = StackApi::users($id)->comments()->get();

$data = StackApi::users($id)->networkActivity()->get();

$data = StackApi::badges($id)->recipients()->get();
shell
composer 

php artisan vendor: publish --provider="Nahid\StackApis\StackApiServiceProvider"