Skip to content

argia-andreas/hitta.se-php-api

Repository files navigation

Hitta.se PHP package

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads


Package under development
Fluent Wrapper around the API Hitta.se provides. Example of usage:

$hitta = new Hitta('::api-user::', '::api-key::');
$result = $hitta->companies()
    ->what('Empire')
    ->where('Deathstar')
    ->find();

foreach($result->companies as $company) {
    echo $company->displayName . "\n";
}

Requirements

PHP 8 is required.

Installation

You can install the package via composer:

composer require grafstorm/hitta_php_package

Usage

// Hitta.se API Wrapper as a Laravel Package
// Search for Swedish companies and people

// Create a new instance of the API wrapper.
$hitta = new Hitta('::api-user::', '::api-key::');

// Combined search. You can also explicitly call Hitta::combined()
$hitta->what('Luke Skywalker')
  ->where('Kiruna')
  ->find();
  
$result = $hitta->combined()
  ->what('Empire')
  ->where('Deathstar')
  ->find();

foreach($result->companies as $company) {
  echo $company->displayName . "\n";
}

foreach($result->people as $person) {
  echo $person->displayName . "\n";
}

// Only Search for people
$hitta->people()
  ->what('Luke Skywalker')
  ->find();
  
// Only Search for companies
$hitta->companies()
  ->what('Empire')
  ->find();
  
// Optional search parameters
$hitta->companies()
  ->what('Luke Skywalker')
  ->where('Kiruna')
  ->pageNumber(1)
  ->pageSize(10)
  ->rangeFrom(100)
  ->rangeTo(150)
  ->find();

// Example of Fetching details of a company or person with findPerson and findCompany.
$result = $hitta->combined()
  ->what('Skywalker')
  ->find();
  
$personId = collect($result->people)->first()->id;
$companyId = collect($result->companies)->first()->id;

$hitta->findPerson($personId);
$hitta->findCompany($companyId);

Testing

Tests requiring proper API keys are skipped unless you provide them in your testing environment.

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published