composer require jobcloud/php-console-kafka-schema-registry
- php: >= 7.4
You can register each command separately like this:
<?php
use Symfony\Component\Console\Application;
use Jobcloud\SchemaConsole\Command\ListAllSchemasCommand;
use Jobcloud\SchemaConsole\SchemaRegistryApi;
use GuzzleHttp\Client;
$client = new Client(
[
'base_uri' => 'url-to-your-schema-api',
//'auth' => ['schema-username', 'schema-password']
]
);
$schemaRegistryApi = new SchemaRegistryApi($client);
$console = new Application();
$console->add(new ListAllSchemasCommand($schemaRegistryApi));
or you can also register them over the service provider:
<?php
use Jobcloud\SchemaConsole\ServiceProvider\CommandServiceProvider;
use Pimple\Container;
$container = new Container();
$container->register(new CommandServiceProvider());
Note: To use the service provider you need to set the following in your container:
- either
kafka.schema.registry.client
which is the guzzle client or alternativelykafka.schema.registry.url
- if you need to use basic authentication you need to set
kafka.schema.registry.username
andkafka.schema.registry.password