PHP code example of coderjerk / scoro-php

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

    

coderjerk / scoro-php example snippets



use Coderjerk\ScoroPhp\ScoroPhp;

//add your company account id and api key, which you've stored safely in your env, for example.
$scoro = new ScoroPhp(
    $_ENV['SCORO_COMPANY_ACCOUNT_ID'],
    $_ENV['SCORO_API_KEY'],
);



$contacts = $scoro->module('contacts')->action('list')->call();

foreach ($contacts->data as $contact) {
   echo "<li>{$contact->name}</li>";
}



$scoro->module('contacts')
    ->action('list')
    ->filter(['contact_type' => 'company'])
    ->call();

// you can dig in deep by nesting arrays depending on your data/module:

$filters = [
    'contact_type' => 'company',
    'means_of_contact' => [
        'website' => 'www.exampleclienta.co.uk'
    ]
];

$scoro->module('contacts')
    ->action('list')
    ->filter($filters)->call();


$scoro->module('contacts')
    ->action('view')
    ->id(36)
    ->call();


$scoro->module('contacts')
    ->action('list')
    ->paginate(10, 2)
    ->call();

shell
composer