cerpus / metadataservice-client
Client to handle communication with the Cerpus MetadataService
Requires
- ext-json: *
- cerpus/cerpushelper: ^1.2
- illuminate/support: ^6.0
- nesbot/carbon: ^2.0
- ramsey/uuid: ^3.8
Requires (Dev)
- fzaninotto/faker: ^1.7
- mockery/mockery: ^1.0
- phpunit/phpunit: ^6.4
- shrikeh/teapot: ^2.3
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.