grafstorm / hitta_php_package
Hitta.se PHP package
Fund package maintenance!
grafstorm
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.3
- spatie/enum: ^3.9
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.17
- phpunit/phpunit: ^9.5
- spatie/ray: ^1.10
- vimeo/psalm: ^4.3
This package is not auto-updated.
Last update: 2024-11-07 13:59:58 UTC
README
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.