PHP code example of darvis / snelstart

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

    

darvis / snelstart example snippets


use Darvis\Snelstart\Services\SnelstartAPI;

class MyController extends Controller
{
    public function index(SnelstartAPI $snelstart)
    {
        $relations = $snelstart->getRelaties();
        $articles = $snelstart->getArtikelen();
        
        return view('overview', compact('relations', 'articles'));
    }
}

$snelstart = app(Darvis\Snelstart\Services\SnelstartAPI::class);
$companyInfo = $snelstart->getCompanyInfo();

$snelstart->getCompanyInfo();

$snelstart->getRelaties();
$snelstart->createRelatie(['naam' => 'Company B.V.', ...]);

$snelstart->getArtikelen();

$snelstart->createVerkooporder([...]);

$snelstart->get('/endpoint', ['query' => 'params']);
$snelstart->post('/endpoint', ['data' => 'here']);
$snelstart->put('/endpoint', ['data' => 'here']);
$snelstart->delete('/endpoint');

use Darvis\Snelstart\Services\EchoService;

$echo = app(EchoService::class);

// GET test
$result = $echo->getEchoResource(['param1' => 'test']);

// POST test
$result = $echo->postEchoResource(['key' => 'value']);

use Darvis\Snelstart\Standalone\SnelstartAPI;

$snelstart = new SnelstartAPI([
    'base_url' => 'https://b2bapi.snelstart.nl/v2',
    'token_url' => 'https://auth.snelstart.nl/b2b/token',
    'client_key' => 'your-custom-clientkey',
    'subscription_key' => 'your-subscription-key',
]);

$companyInfo = $snelstart->getCompanyInfo();
$relations = $snelstart->getRelaties();

use Darvis\Snelstart\Standalone\SnelstartAPI;

// Reads from SNELSTART_BASE_URL, SNELSTART_TOKEN_URL, 
// SNELSTART_CLIENT_KEY, SNELSTART_SUBSCRIPTION_KEY
$snelstart = SnelstartAPI::fromEnv();

$companyInfo = $snelstart->getCompanyInfo();
bash
php artisan vendor:publish --tag=snelstart-config
bash
php artisan snelstart:test