PHP code example of arueckauer / harvest-api

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

    

arueckauer / harvest-api example snippets




declare(strict_types = 1);

return [
    arueckauer\HarvestApi\ClientFactory::class => [
        'config' => [
            'headers' => [
                'Authorization'      => 'Bearer $ACCESS_TOKEN',
                'Harvest-Account-Id' => '$ACCOUNT_ID',
                'User-Agent'         => 'MyApp ([email protected])',
            ],
        ],
    ],
];




declare(strict_types=1);

namespace App\Handler;

use Psr\Container\ContainerInterface;

class HarvestApiFactory
{
    public function __invoke(ContainerInterface $container) : HarvestApi
    {
        return new HarvestApi($container->get(\arueckauer\HarvestApi\Client::class));
    }
}




// public/index.php
    
n'      => 'Bearer $ACCESS_TOKEN',
    'Harvest-Account-Id' => '$ACCOUNT_ID',
    'User-Agent'         => 'MyApp ([email protected])',
];
$client = new \arueckauer\HarvestApi\Client($headers);