werkspot / kvk-api Goto Github PK
View Code? Open in Web Editor NEWKVK API php client
License: MIT License
KVK API php client
License: MIT License
Hi,
I'm trying to retrieve data from a non-existing kvk number:
KVK returns:
{
"apiVersion": "2.0",
"meta": {},
"error": {
"code": 404,
"message": "NotFound",
"reason": "No companies found for the given query."
}
}
This is not properly handled by:
private function decodeJsonToArray(string $json): array
{
return json_decode($json, true)['data'];
}
The problem is here:
https://github.com/Werkspot/kvk-api/blob/master/src/Http/Search/ProfileQuery.php#L63
Because it only accepts an int, and casts a string to an int, a string like '01234567' becomes 1234567, which is invalid. The solution is to accept a string value instead.
EDIT: I'll create a pull request for this.
add the following to the scrutinizer config
build:
dependencies:
before:
- composer install -d instapro --no-scripts
nodes:
analysis:
project_setup:
override: true
tests:
override:
- php-scrutinizer-run --enable-security-analysis
filter:
paths:
- "src/"
dependency_paths:
- "vendor/"
build_failure_conditions:
- 'issues.new.exists'
- 'project.metric_change("scrutinizer.test_coverage", < -0.05)'
instead of this:
->setFinder(
PhpCsFixer\Finder::create()
->exclude('bin')
->exclude('coverage')
->exclude('vendor')
->in(__DIR__)
);
do this:
->setFinder(
PhpCsFixer\Finder::create()
->in([__DIR__ . '/src', __DIR__ . '/tests'])
->name('*.php')
);
since we already use Scrutinizer for code-coverage
Hello,
I added the example of the readme, but this doesnt work..
Getting:
Class 'Werkspot\KvkApi\ClientFactory' not found
For:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Werkspot\KvkApi\ClientFactory;
use Werkspot\KvkApi\Http\Endpoint\Production;
use Werkspot\KvkApi\Http\Search\ProfileQuery;
class KvkCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'kvk {id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Search KVK';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$client = ClientFactory::create(env('KVK_API'), new Production());
$profileQuery = new ProfileQuery();
$profileQuery->setKvkNumber($this->argument('id'));
$kvkPaginator = $client->getProfile($profileQuery);
foreach ($kvkPaginator->getItems() as $company) {
$this->info(json_encode($company));
}
// get next set of data
$kvkPaginator = $client->getNextPage($kvkPaginator);
}
}
Hi,
We're trying to use your kvk-api implementation but we're getting a SSL error which we can't figure out. Renegotiation disabled.
Tried with and without adding the cert chain to the trusted certificates on ubuntu. Also tried with new Production()
in case it was only an issue on the test endpoint but the same result.
Ever run into this issue by any coincidence?
$client = KvkClientFactory::create(config('kvk.api_key'), new Testing(), base_path('vendor/werkspot/kvk-api/cert/Private_G1_chain.pem'));
$searchQuery = new SearchQuery();
$searchQuery->setStreet('ABEBE Bikilalaan');
$kvkPaginator = $client->fetchSearch($searchQuery);
dd($kvkPaginator);
add a readme with info on what this is, how it works, build tags, ...
I usually start from this template:
<lib-name-description>
Add here a short description of what is the project. This should explain what the project is.
Add here a short description of the motivation behind the creation and maintenance of the project.
This should explain why the project exists.
To install the library, run the command below and you will get the latest version:
composer require hgraca/lib-name
Add additional notes about how to deploy this on a live system
make run
make test
make test-acc
make test-func
make test-int
make test-unit
make coverage
make cs-fix
make dep-install
make dep-update
make build-container-dev
make build-container-prd
Hi,
I'd very much like to start using this library. However there are no releases and the original maintainer does not work for your company anymore.
It would be awesome to use Sematic versioning for example, so that we don't have to require the "dev-master" version in our projects.
What needs to be done to release a "v1.0"/stable version?
Dus alleen de KVK API Profile geïmplementeerd en niet de KVK API Search? Open voor PR? @LauLaman
Change make commands names, and order them alfabetically:
cs-fix => fix-cs
all-tests => test
coverage => test-coverage
integration-tests => test-integration
unit-tests => test-unit
How can I use the test api
The current APIs KVK Handelsregister Search and Profile will be phased out.
As of 1 April 2022, these APIs will cease to exist:
These are the new APIs that take their place:
More info: https://developers.kvk.nl/support/switch-to-new-apis
Since today, the new KvK API certificate chain causes issues - a cURL error is returned:
cURL error 60: Unrecognized Object Identifier. (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
I assume this happens for everyone. Message from KvK API Team:
Dear valued costumer,
On September 28, KVK (Chamber of Commerce) will switch to a private root certificate for connecting
to the KVK API Search and KVK API Profile. This implies that all (!) customers need to take immediate
action. An API-key will not be sufficient to provide a connection to the API’s. You need to adapt your
software. This can be achieved by trusting the trust chain in your software.
Instructions can be found https://developers.kvk.nl/guides.
The blacklist functionality is used to remove code that is inside the white list.
As that is not the case, that config is not used.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.