cx-reports / api-client
A client for interacting and downloading reports from the CxReports
0.0.1
2025-02-24 22:01 UTC
Requires
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is not auto-updated.
Last update: 2025-08-12 23:20:06 UTC
README
Overview
The cx-reports/api-client
provides an easy-to-use interface for interacting with the CxReports API. This library allows developers to preview reports, download reports as PDFs, retrieve workspace information, and more.
Features
- Authentication with API tokens
- Preview reports by ID
- Download reports as PDF
- Fetch workspaces
- Retrieve report types
Installation
You can install the library via Composer:
composer require cx-reports/api-client
Usage
Initializing the Client
require 'vendor/autoload.php'; use CxReports\Client\CxReportsClient; $url = ""; $workspace_id = 0; $pat = ""; $client = new CxReportsClient($url, $workspace_id, $pat);
Downloading a Report as PDF
$response = $client->downloadPdf("149", [], 26); $response = $client->downloadPdf("149", [], 26);
Fetching Workspaces
$workspaces = $client->getWorkspaces();
Fetching Report Types
$reportTypes = $client->getReportTypes();
Error Handling
The library provides built-in error handling:
try { $report = $client->getReport("invalid-id"); } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
License
This library is licensed under the MIT License.
Contributing
Contributions are welcome! Please submit a pull request or open an issue on GitHub.
Support
For any issues or questions, contact support@cx-reports.com.