grafstorm / hittase-php-api-for-laravel
This is my package Hitta
Fund package maintenance!
grafstorm
Requires
- php: ^8.0
- grafstorm/hitta_php_package: @dev
- illuminate/contracts: ^8.37
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- brianium/paratest: ^6.2
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.15
- phpunit/phpunit: ^9.3
- spatie/laravel-ray: ^1.9
- vimeo/psalm: ^4.4
This package is not auto-updated.
Last update: 2024-11-07 13:06:30 UTC
README
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.
Installation
You can install the package via composer:
composer require grafstorm/hittase-php-api-for-laravel
Configuration
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'), ];
Usage
// 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);
Testing
See grafstorm/hitta_php_package for tests.
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.