This package uses the Hitta.se API PHP package grafstorm/hitta_php_package
and packages it for Laravel.
All you need to get going is setting the correct callerId and apiKey in you .env file.``
See http://hitta.github.io/public/http-api/ for more detailed info on what fields are available.
This package is an unofficial package and is still in beta.
You can install the package via composer:
composer require grafstorm/hittase-php-api-for-laravel
You can publish the config file with:
php artisan vendor:publish --provider="Grafstorm\Hitta\HittaServiceProvider" --tag="hittase-php-api-for-laravel-config"
Be sure to add callerId and apiKey in your .env file:
HITTA_CALLER_ID=## your caller id ##
HITTA_API_KEY=## your api key ##
This is the contents of the published config file:
return [
'callerId' => env('HITTA_CALLER_ID'),
'apiKey' => env('HITTA_API_KEY'),
];
// Hitta.se API Wrapper as a Laravel Package
// Search for Swedish companies and people
// 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();
// Fetching details of a company or person with findPerson and findCompany.
$result = Hitta::people()
->what('Luke Skywalker')
->find();
$personId = collect($result->people)->first()->id;
$companyId = collect($result->companies)->first()->id;
Hitta::findPerson($personId);
Hitta::findCompany($companyId);
See grafstorm/hitta_php_package for tests.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.