sq/laravel-sevdesk-api

A helpful Sevdesk API client for Laravel.

v1.3 2023-01-09 14:52 UTC

This package is auto-updated.

Last update: 2024-05-09 17:55:31 UTC


README

Latest Version on Packagist Total Downloads Test

This package make a connection to the sevdesk api and let you interact with it.

Sevdesk API Documentation

Installation

You can install the package via composer:

composer require exlo89/laravel-sevdesk-api

Set your api token with

SEVDESK_API_TOKEN=xxxxxxxx

Optionally you can publish the config file with:

php artisan vendor:publish --provider="Exlo89\LaravelSevdeskApi\SevdeskApiServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    /*
     * Api token you from sevdesk. 
     */
    'api_token' => env('SEVDESK_API_TOKEN', ''),
];

Usage

First Instantiate a sevdesk instance.

$sevdeskApi = SevdeskApi::make();

Create Contact

Create sevdesk contacts. There are 4 different default contact types in sevdesk.

  • supplier
  • customer
  • partner
  • prospect customer

The optional $parameters is for additional information like description, vatNumber or bankNumber.

$sevdeskApi->contact()->createSupplier('Supplier Organisation', $parameters);
$sevdeskApi->contact()->createCustomer('Customer Organisation', $parameters);
$sevdeskApi->contact()->createPartner('Partner Organisation', $parameters);
$sevdeskApi->contact()->createProspectCustomer('Prospect Customer Organisation', $parameters);

For accounting contact you have to create a contact first. You create a accounting contact using the created contact id.

$sevdeskApi->contact()->createAccountingContact($contactId);

For custom contact types use your custom category id.

$sevdeskApi->contact()->createCustom('Custom Organisation', $categoryId, $parameters);

Check Create Contact for more information.

Retrieve Contact

To get all contacts.

$sevdeskApi->contact()->all();
$sevdeskApi->contact()->allSupplier();
$sevdeskApi->contact()->allCustomer();
$sevdeskApi->contact()->allPartner();
$sevdeskApi->contact()->allProspectCustomer();

To get all contacts from a custom type.

$sevdeskApi->contact()->allCustom($categoryId);

To get a single contact.

$sevdeskApi->contact()->get($contactId);

Update Contact

To update a single contact. $contactId is required.

$sevdeskApi->contact()->update($contactId, $parameters);

Delete Contact

To delete a single contact. $contactId is required.

$sevdeskApi->contact()->delete($contactId);

Create Contact Address

$sevdeskApi->contactAddress()->create($contactId, $parameters);

Create Communication Way

Create phone number.

$sevdeskApi->communicationWay()->createPhone($contactId, $phoneNumber);

Create email.

$sevdeskApi->communicationWay()->createEmail($contactId, $email);

Create website.

$sevdeskApi->communicationWay()->createWebsite($contactId, $website);

Retrieve Communication Way

Retrieve all communication ways.

$sevdeskApi->communicationWay()->all();

Retrieve communication ways of a specific contact.

$sevdeskApi->communicationWay()->get($contactId);

Delete Communication Way

To delete a single communication way.

$sevdeskApi->communicationWay()->delete($communicationWayId);

Retrieve Invoice

To get all invoices.

$sevdeskApi->invoice()->all();

To get all invoices filtered by status draft, open or payed.

$sevdeskApi->invoice()->allDraft();
$sevdeskApi->invoice()->allOpen();
$sevdeskApi->invoice()->allPayed();

To get all invoices filtered by a giving $contactId.

$sevdeskApi->invoice()->allByContact($contactId);

To get all invoices filtered by giving $timestamp.

$sevdeskApi->invoice()->allAfter($timestamp);
$sevdeskApi->invoice()->allBefore($timestamp);

To download pdf file of the giving $invoiceId.

$sevdeskApi->invoice()->download($invoiceId);

To send invoice to giving $email. Use $subject and $text to edit the mail. $text can contain html.

$sevdeskApi->invoice()->sendPerMail($invoiceId, $email, $subject, $text);

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email hello@martin-appelmann.de instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.