PHP code example of muhammadhuzaifa / telescope-guzzle-watcher

1. Go to this page and download the library: Download muhammadhuzaifa/telescope-guzzle-watcher 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/ */

    

muhammadhuzaifa / telescope-guzzle-watcher example snippets


// config/telescope.php

return [
    'watchers' => [
        // ... other watchers ...
        \MuhammadHuzaifa\TelescopeGuzzleWatcher\Watchers\TelescopeGuzzleWatcher::class => true,
    ],
];

// Correct – the factory will wire up on_stats and Telescope logging
$client = app(\GuzzleHttp\Client::class);

// Optional custom configuration
$client = app(\GuzzleHttp\Client::class, [
    'config' => [
        'base_uri' => 'https://api.example.com',
        'timeout' => 5,
    ],
]);

// Avoid instantiating Guzzle manually if you want Telescope coverage
$client = new \GuzzleHttp\Client(); // no Telescope logging

    $this->app->bind('billing-client', function () {
        return app(\GuzzleHttp\Client::class, [
            'config' => [
                'base_uri' => config('services.billing.url'),
                'headers' => ['Accept' => 'application/json'],
            ],
        ]);
    });
    

    use HubSpot\Factory\HubSpotFactory;
    use HubSpot\Discovery\Discovery;

    $this->app->singleton(Discovery::class, function ($app) {
        $guzzle = $app->make(\GuzzleHttp\Client::class, [
            'config' => [
                'base_uri' => 'https://api.hubapi.com',
                'timeout' => 10,
            ],
        ]);

        return HubSpot\Factory::createWithAccessToken(
            'your-access-token', 
            $guzzle
        );
    });
    

    use HubSpot\Discovery\Discovery;

    Route::get('/hubspot/contacts', function (Discovery $hubspot) {
        return $hubspot->crm()->contacts()->basicApi()->getPage()->toArray();
    });
    
bash
php artisan vendor:publish --tag="telescope-guzzle-watcher-config"