Search by

furious-squad / furious-api-sdk

furious

Furious API client SDK

Package info

github.com/furious-squad/furious-api-sdk

Homepage

pkg:composer/furious-squad/furious-api-sdk

Statistics

Installs: 59

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

1.2.3 2026-11-03 08:40 UTC

README

Latest Packagist Version Total Downloads Tests PHPUnit

The Furious PHP SDK provides convenient access to the Furious ERP API from PHP applications. It is designed for developers building integrations with Furious ERP features such as CRM, project tracking, time management, HR, accounting, and more.

🚀 Getting Started

Requirements

  • PHP ^7.4

Installation

composer require furious-squad/furious-api-sdk

⚙️ SDK Initialization

use Furious\FuriousApiSdk\FuriousApiSdk;
use Furious\FuriousApiSdk\Model\Config;

$config = new Config("https://<my instance url>");
$sdk = new FuriousApiSdk($config, [
  'timeout' => 5
]);

🔐 Authentication

$sdk->authenticate([
  'username' => 'myAPIUsername',
  'password' => 'myAPIPassword'
]);

This method sets a valid JWT token for the session, used for all authorized API calls.

📚 Resource Usage Guide

Access a Resource

use Furious\FuriousApiSdk\Resource\Absence;

$absence = $sdk->getResource(Absence::class);

Basic Search (no filters)

$results = $absence->search(['pseudo']);

Filtered Search

use Furious\FuriousApiSdk\Query\Filter\Equal;

$results = $absence->search(
  ['pseudo', 'status', 'start_date'],
  [ Equal::set('pseudo', 'john.doe') ]
);

Filtered & Sorted Search

use Furious\FuriousApiSdk\Query\Order\OrderAsc;

$results = $absence->search(
  ['pseudo', 'status', 'start_date'],
  [ Equal::set('pseudo', 'john.doe') ],
  [ OrderAsc::field('start_date') ]
);

Batch Search (parallel queries)

searchBatch fires multiple search queries in parallel using Guzzle promises, significantly reducing total response time compared to sequential calls.

Each entry in the batch is identified by a key of your choice and accepts the same parameters as search.

$postit = $sdk->getResource(Postit::class);
 
$today        = (new \DateTime())->format('Y-m-d');
$yesterday    = (new \DateTime())->sub(new \DateInterval('P1D'))->format('Y-m-d');
$sixMonthsAgo = (new \DateTime())->sub(new \DateInterval('P6M'))->format('Y-m-d');

$baseFilters = [
    Equal::set('type', 'crm'),
    Equal::set('id_item', '12345'),
    NotEqual::set('status', '0'),
];
 
$results = $postit->searchBatch([
  'future' => [
      'fields'  => ['id'],
      'filters' => array_merge($baseFilters, [
          Greatest::set('date', $today),
      ]),
      'orders' => [],
      'limit'  => 1,
  ],
  'past' => [
      'fields'  => ['id'],
      'filters' => array_merge($baseFilters, [
          LessOrEqual::set('date', $yesterday),
          Greatest::set('date', $sixMonthsAgo),
      ]),
      'orders' => [],
      'limit'  => 1,
  ]
];

$futurCount = $results['future']['meta']['totalElementsWithFilters'] ?? 0;
$pastCount  = $results['past']['meta']['totalElementsWithFilters']   ?? 0;

Create a Resource

$response = $absence->create([
  'pseudo'     => 'john.doe',
  'start_date' => '2025-01-01',
  'end_date'   => '2025-01-05',
  'entity'     => 'entity_1',
  'half_day'   => '0',
  'type'       => 'home_office'
]);

Update a Resource

$updateResponse = $absence->update([
  'id'         => $absenceId,
  'pseudo'     => 'jane.doe',
  'start_date' => '2025-01-02',
  'end_date'   => '2025-01-06'
]);

Create with Custom Fields

use Furious\FuriousApiSdk\Resource\Contract;

$contract = $sdk->getResource(Contract::class);

$response = $contract->create([
  'name'               => 'Example Company',
  'date_limit'         => '2025-07-03',
  'client_company_id'  => 12345,
  'project_id'         => 12345,
  'content'            => 'Example content',
  'prevenance'         => 123,
  'tacite_reconduction'=> 456,
  'entity'             => 'entity_3',
  'custom_fields'      => [
    [ 'name' => 'custom_field_1', 'value' => 'value_1' ],
    [ 'name' => 'custom_field_2', 'value' => 'value_2' ]
  ]
]);

Advanced Filter: IsNull

use Furious\FuriousApiSdk\Query\Filter\IsNull;

$results = $absence->search(
  ['id', 'pseudo', 'end_date'],
  [ IsNull::set('end_date') ]
);

Generate GraphQL Query String

$gql = $absence->buildSearchString(
  ['pseudo', 'start_date'],
  [ Equal::set('pseudo', 'jane.doe') ],
  [ OrderAsc::field('start_date') ]
);

echo $gql;

Batch Create (up to 10 entries)

$response = $absence->create([
  [
    'pseudo'     => 'john.doe',
    'start_date' => '2025-09-01',
    'end_date'   => '2025-09-05',
    'entity'     => 'entity_1',
    'half_day'   => '0',
    'type'       => 'home_office'
  ],
  [
    'pseudo'     => 'jane.doe',
    'start_date' => '2025-10-01',
    'end_date'   => '2025-10-05',
    'entity'     => 'entity_2',
    'half_day'   => '0',
    'type'       => 'home_office'
  ]
]);

❗ Error Handling

All SDK operations may throw:

  • Furious\FuriousApiSdk\Exception\SdkException
  • Furious\FuriousApiSdk\Exception\ApiException

Use try/catch blocks to handle them gracefully.

Run unit tests

vendor/bin/phpunit ./tests