Search by

conta365 / conta365-api

kerattila

Conta365.ro is a platform for managing invoices, handling eInvoices with RO eFactura and other business related activities.

Package info

gitlab.com/conta365/conta365-api

pkg:composer/conta365/conta365-api

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 1

v1.0.0 2026-11-24 22:07 UTC

This package is not auto-updated.

Last update: 2026-12-01 02:58:40 UTC


README

Conta365.ro - Aplicatie de facturare integrat RO eFactura

Conta365 PHP SDK

A standalone PHP 8.4+ client for the Conta365 web-services API. Version 1 has no Laravel dependency and uses explicit, immutable objects instead of dynamic client lookups and global authentication state.

Installation

composer require conta365/conta365-api

API endpoint and documentation

The SDK calls the company-scoped web-services API at:

{baseUri}/webservices/api/{companyId}

The default baseUri is https://api.conta365.ro. For development, configure baseUri: 'https://demo-api.conta365.ro'.

Interactive Swagger documentation is available at demo-api.conta365.ro.

Usage

use Conta365\Client;
use Conta365\Configuration;
use Conta365\Dto\CreateInvoice;
use Conta365\Enum\CompanyAttributeType;
use Conta365\Enum\Currency;
use Conta365\Enum\InvoiceType;

$client = new Client(new Configuration(
    accessToken: 'ey…',
    companyId: 'company-uuid',
));

$invoices = $client->invoices()->list(
    page: 1,
    limit: 25,
    include: ['items'],
);

$invoice = $client->invoices()->create(new CreateInvoice([
    'type' => InvoiceType::Commercial->value,
    'invoice_serial_id' => 'serial-uuid',
    'number' => '1',
    'issue_date' => '2026-11-24',
    'due_date' => '2026-12-09',
    'currency' => Currency::Ron->value,
    'items' => [],
]));

The runnable examples use environment variables rather than embedding credentials:

$env:CONTA365_ACCESS_TOKEN = 'your-access-token'
$env:CONTA365_COMPANY_ID = 'your-company-uuid'
$env:CONTA365_BASE_URI = 'https://demo-api.conta365.ro'
php examples/invoice_serials.php

Available workflows:

  • examples/invoice_serials.php — find active invoice serials and their next numbers.
  • examples/invoice.php — create a complete example invoice.
  • examples/invoice_pdf.php — download an invoice PDF (CONTA365_INVOICE_ID required).
  • examples/invoice_collections.php — list an invoice's allocated collections (CONTA365_INVOICE_ID required).

Invoice and CompanyAttribute are immutable response DTOs. Call toArray() to obtain the API data, or id() for their identifier. List methods return Page, which contains items and server-provided meta.

API shape

$client->invoices()->get($id);
$client->invoices()->create(new CreateInvoice($payload));
$client->invoices()->update($id, new UpdateInvoice($payload));
$client->invoices()->delete($id);
$pdf = $client->invoices()->pdf($id);
file_put_contents($pdf->filename ?? 'invoice.pdf', $pdf->contents);

$client->invoiceCollections()->list($invoiceId);
$client->invoiceCollections()->create($invoiceId, new CreateInvoiceCollection($payload));
$client->invoiceCollections()->update($invoiceId, $collectionId, new UpdateInvoiceCollection($payload));
$client->invoiceCollections()->delete($invoiceId, $collectionId);

$client->companyAttributes()->list(CompanyAttributeType::InvoiceSerialNumberPeriod->value); // Active today
$client->companyAttributes()->list(CompanyAttributeType::InvoiceSerialNumberPeriod->value, forDate: new DateTimeImmutable('2026-12-01'));
$client->companyAttributes()->get(CompanyAttributeType::InvoiceSerialNumberPeriod->value, $id);

API enums

The SDK exposes PHP backed enums for server-defined values: InvoiceType, Currency, DiscountType, DiscountReason, VatCategory, UnitCode, InvoiceCollectionType, CompanyAttributeType, and CollectionAccountSubtype. Pass their ->value in request payloads. Values determined by a company (for example invoice serial IDs, account IDs, VAT rates, and payment identifiers) are intentionally left as runtime API data rather than SDK constants.

HTTP failures throw Conta365\Exception\ApiException, carrying the status code and decoded API payload when available.

Migrating from 0.x

This is a breaking release. Replace Config with Configuration, Conta365Api with Client, and dynamic calls such as getInvoiceClient() with $client->invoices(). Replace Spatie\LaravelData model construction with CreateInvoice or UpdateInvoice payload DTOs. The SDK no longer exposes write operations for company attributes because the current web-services API only publishes their read endpoints.

Development

composer install
composer test

License

MIT