PHPackages                             lucianotonet/cartesia-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lucianotonet/cartesia-php

ActivePackage[Utility &amp; Helpers](/categories/utility)

lucianotonet/cartesia-php
=========================

Cartesia PHP SDK

0.0.1(1y ago)22.6k↓100%MITPHPPHP ^8.1.0

Since Sep 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/lucianotonet/cartesia-php)[ Packagist](https://packagist.org/packages/lucianotonet/cartesia-php)[ RSS](/packages/lucianotonet-cartesia-php/feed)WikiDiscussions main Synced 3mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Cartesia PHP
============

[](#cartesia-php)

[![Latest Stable Version](https://camo.githubusercontent.com/9a6371459807b8e3217775fc697ed82c9efbc780c94180055fe2971316d371e3/68747470733a2f2f706f7365722e707567782e6f72672f6c756369616e6f746f6e65742f63617274657369612d7068702f762f737461626c65)](https://packagist.org/packages/lucianotonet/cartesia-php)[![Total Downloads](https://camo.githubusercontent.com/19d339b9678209f39fd4e33cc43dbe38d8327e260b33b240e916b0fb931a1ed4/68747470733a2f2f706f7365722e707567782e6f72672f6c756369616e6f746f6e65742f63617274657369612d7068702f646f776e6c6f616473)](https://packagist.org/packages/lucianotonet/cartesia-php)[![License](https://camo.githubusercontent.com/c0e55c5c1033562eb3725bd58cde89192b10e58c795b7d97832f456c2660fc46/68747470733a2f2f706f7365722e707567782e6f72672f6c756369616e6f746f6e65742f63617274657369612d7068702f6c6963656e7365)](https://packagist.org/packages/lucianotonet/cartesia-php)

Description
-----------

[](#description)

This PHP library provides a robust interface to interact with the Cartesia REST API, allowing you to seamlessly integrate Cartesia's advanced voice cloning and speech synthesis capabilities into your PHP applications. **Please note that this library is not officially affiliated with Cartesia AI.**

Key Features
------------

[](#key-features)

- **High-Quality Speech Synthesis:** Convert text into natural and expressive speech using Cartesia's state-of-the-art models.
- **Custom Voice Cloning:** Create personalized synthetic voices that capture the unique essence and tone of your desired speakers.
- **Simplified Voice Management:** Easily manage your cloned voices, including listing, retrieving, updating, and deleting.
- **Intuitive and User-Friendly Interface:** The library offers a straightforward and well-documented interface, making integration with your PHP projects quick and easy.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

The recommended way to install the Cartesia PHP library is via Composer:

```
composer require lucianotonet/cartesia-php
```

### Usage

[](#usage)

Here's a basic example of how to use the library to generate speech from text:

```
require 'vendor/autoload.php';

use LucianoTonet\CartesiaPHP\CartesiaClient;

// Initialize the Cartesia client with your API key
$client = new CartesiaClient('your_api_key');

// Define the speech synthesis parameters
$modelId = 'sonic-english'; // Voice model ID
$transcript = 'Hello, world!'; // Text to be converted to speech
$voiceId = 'a0e99841-438c-4a64-b679-ae501e7d6091'; // Cloned voice ID

// Make a speech synthesis request
try {
    $response = $client->streamSpeechBytes([
        'context_id' => 'happy-monkeys-fly',
        'model_id' => $modelId,
        'transcript' => $transcript,
        'voice' => [
            'mode' => 'id',
            'id' => $voiceId
        ],
        'output_format' => [
            'container' => 'raw',
            'encoding' => 'pcm_f32le',
            'sample_rate' => 44100
        ]
    ]);

    // Save the generated audio to a file
    file_put_contents('hello_world.wav', $response->getBody());

    echo "Audio successfully generated at hello_world.wav\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
```

Roadmap
-------

[](#roadmap)

- API Status and Version
- Create Voice
- Delete Voice
- Update Voice
- Get Voice
- List Voices
- Clone Voice (Clip)
- Mix Voices
- Stream Speech (Bytes)
- Stream Speech (Server-Sent Events)
- Stream Speech (WebSocket)
- Localize Voice

Running the examples
--------------------

[](#running-the-examples)

To run the examples provided in the `examples` directory, copy the `.env.example` file to `.env` and update the `CARTESIA_API_KEY` constant with your Cartesia API key:

```
# .env
CARTESIA_API_KEY=your_api_key
```

Then, start the PHP server in the package root directory:

```
php -S 127.0.0.1:80
```

Now you can access the examples in your browser at `http://127.0.0.1/examples/`.

Complete Documentation
----------------------

[](#complete-documentation)

For detailed information on all available features and options, please refer to the original REST API documentation: [https://docs.cartesia.ai](https://docs.cartesia.ai/api-reference/endpoints/).

For the full source code and examples, visit the GitHub repository:

Support
-------

[](#support)

If you encounter any issues or have any questions about the library, please feel free to open an issue on GitHub. Contributions to the project are also welcome!

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

656d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2693019?v=4)[Luciano Tonet](/maintainers/lucianotonet)[@lucianotonet](https://github.com/lucianotonet)

---

Top Contributors

[![lucianotonet](https://avatars.githubusercontent.com/u/2693019?v=4)](https://github.com/lucianotonet "lucianotonet (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lucianotonet-cartesia-php/health.svg)

```
[![Health](https://phpackages.com/badges/lucianotonet-cartesia-php/health.svg)](https://phpackages.com/packages/lucianotonet-cartesia-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[roundcube/roundcubemail

The Roundcube Webmail suite

7.0k1.4k3](/packages/roundcube-roundcubemail)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
