vdhicts/nuclino-api-client

A client for the API of Nuclino

v3.0.0 2024-03-17 07:10 UTC

This package is auto-updated.

Last update: 2024-05-17 07:38:18 UTC


README

Easy to use client for the API of Nuclino.

Requirements

This package requires at least PHP 8.1.

Installation

This package can be used in any PHP project or with any framework.

You can install the package via composer:

composer require vdhicts/nuclino-api-client

Usage

This package is just an easy client for using the Nuclino API. Please refer to the API documentation for more information about the responses.

Getting started

// Initialize the API
$api = new \Vdhicts\Nuclino\Nuclino($apiKey);

// List the items
$response = $api->listItems();

if ($response->ok()) {
    $response->json('data');
}

Handling errors

A Response object will always be returned. See Error handling of the Http Client.

if ($response->failed()) {
    var_dump($response->serverError());
}

Laravel

This package can be easily used in any Laravel application. I would suggest adding your credentials to the .env file of the project:

NUCLINO_API_KEY=apikey

Next create a config file nuclino.php in /config:

<?php

return [
    'api_key' => env('NUCLINO_API_KEY'),
];

And provide the API key to the client:

$api = new \Vdhicts\Nuclino\Nuclino(config('nuclino.api_key'));

In the future I might make a Laravel specific package which uses this package.

Tests

Unit tests are available in the tests folder. Run with:

composer test

When you want a code coverage report which will be generated in the build/report folder. Run with:

composer test-coverage

Contribution

Any contribution is welcome, but it should meet the PSR-12 standard and please create one pull request per feature/bug. In exchange, you will be credited as contributor on this page.

Security

If you discover any security related issues in this or other packages of Vdhicts, please email info@vdhicts.nl instead of using the issue tracker.

Support

This package isn't an official package from Nuclino, so they probably won't offer support for it. If you encounter a problem with this client or has a question about it, feel free to open an issue on GitHub.

License

This package is open-sourced software licensed under the MIT license.

About Vdhicts

Vdhicts is the name of my personal company for which I work as freelancer. Vdhicts develops and implements IT solutions for businesses and educational institutions.