PHP code example of allstak / sdk-symfony

1. Go to this page and download the library: Download allstak/sdk-symfony 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/ */

    

allstak / sdk-symfony example snippets


return [
    // ...
    AllStak\SymfonyBundle\AllStakBundle::class => ['all' => true],
];

use AllStak\AllStak;

final class CheckoutController
{
    public function __construct(private AllStak $allstak) {}

    public function pay(): Response
    {
        $this->allstak->addBreadcrumb('default', 'payment started');
        try {
            // ...
        } catch (\Throwable $e) {
            $this->allstak->captureError($e);
            throw $e;
        }
    }
}

public function __construct(private \Symfony\Contracts\HttpClient\HttpClientInterface $client) {}

public function fetch(): array
{
    return $this->client->request('GET', 'https://example.com/api')->toArray();
    // recorded as an outbound http-request + client span on this request's trace
}