cerpus/metadataservice-client

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.3.0) of this package.

Client to handle communication with the Cerpus MetadataService

1.3.0 2021-02-24 11:56 UTC

This package is auto-updated.

Last update: 2024-03-19 10:10:39 UTC


README

PHP library to communicate with the Cerpus Metadata Service

Installation

Use composer to require the package

composer require cerpus/metadataservice-client

Laravel

When composer has finished, add the service provider to the providers array in config/app.php

Cerpus\MetadataServiceClient\Providers\MetadataServiceClientServiceProvider::class,

Add the following to the alias array in config/app.php

'MetadataService' => \Cerpus\MetadataServiceClient\MetadataServiceClient::class,

Publish the config file from the package

php artisan vendor:publish --provider="Cerpus\MetadataServiceClient\Providers\MetadataServiceClientServiceProvider" --tag=config

Lumen

Not tested, but should work. You are welcome to update this documentation if this does not work!

Add service provider in app/Providers/AppServiceProvider.php

public function register()
{
    $this->app->register(Cerpus\MetadataServiceClient\Providers\MetadataServiceClientServiceProvider::class);
}

Uncomment the line that loads the service providers in bootstrap/app.php

$app->register(App\Providers\AppServiceProvider::class);

Edit the configuration file

Edit config/metadataservice-client.php

<?php
return [
    "adapters" => [
        "cerpus-metadata" => [
            "handler" => \Cerpus\MetadataServiceClient\Adapters\MetadataServiceAdapter::class,
            "base-url" => '<url to service>',
        ],
    ],
];

Example for a developer setup:

<?php

return [
    "adapters" => [
        "cerpus-metadata" => [
            "handler" => \Cerpus\MetadataServiceClient\Adapters\CerpusMetadataServiceAdapter::class,
            "base-url" => env('METADATA_SERVER'),
        ],
    ],
];

Usage

Resolve from the Laravel Container

$cerpusMetadata = app(Cerpus\MetadataServiceClient\Contracts\MetadataServiceContract::class)

or alias

$cerpusMetadata = CerpusMetadataServiceAdapter::<Class Method>

or directly

$cerpusMetadata = new Cerpus\MetadataServiceClient\Adapters\CerpusMetadataServiceAdapter(Client $client);

The last one is not recommended.

Class methods

Method calls return an object or throws exceptions on failure.

More info

See the Confluence Metadata storage service API documentation

License

This package is released under the GNU General Public License 3.0. See the LICENSE file for more information.