PHPackages                             arthurdick/term-to-svg - 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. [CLI &amp; Console](/categories/cli)
4. /
5. arthurdick/term-to-svg

ActiveProject[CLI &amp; Console](/categories/cli)

arthurdick/term-to-svg
======================

A command-line PHP tool that converts terminal session recordings into animated SVG files.

v5.2.0(10mo ago)4151MITPHPPHP &gt;=7.4CI passing

Since Aug 2Pushed 8mo agoCompare

[ Source](https://github.com/arthurdick/term-to-svg)[ Packagist](https://packagist.org/packages/arthurdick/term-to-svg)[ Docs](https://github.com/arthurdick/term-to-svg)[ RSS](/packages/arthurdick-term-to-svg/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (2)Versions (26)Used By (0)

term-to-svg: Animated Terminal Session Recorder
===============================================

[](#term-to-svg-animated-terminal-session-recorder)

[![term-to-svg Demo](demo.svg)](demo.svg)

`term-to-svg` is a command-line PHP tool that converts terminal session recordings (made with the `script` command) into highly customizable, animated SVG files. This allows you to easily embed interactive and visually appealing terminal demonstrations directly into your project `README`s, websites, or documentation.

Unlike GIF animations, SVG files are vector-based, resulting in sharper visuals at any zoom level, smaller file sizes, and the ability to be manipulated with CSS and JavaScript.

---

Features
--------

[](#features)

- **High Fidelity Playback**: Accurately interprets ANSI escape codes for cursor movement, color changes, inverse video, character/line manipulation, scroll regions, and screen clearing to reproduce your terminal session as precisely as possible.
- **Multiple Animation Engines**: Choose between two animation engines:
    - **CSS Animations (Default)**: A modern, efficient engine that is widely supported and ideal for web embedding.
    - **SMIL**: A powerful, self-contained animation engine that is also well-supported.
- **Powerful Theming**: Customize the look and feel of your SVG with a simple JSON theme file. A variety of pre-made light and dark themes are included.
- **Configurable**: Supports configuration for terminal dimensions, font size, and more via command-line flags that can override theme settings.
- **Automatic Geometry Detection**: Can automatically detect terminal dimensions from the `script` log file if available.
- **Lightweight**: A lightweight PHP application with no external runtime dependencies.

---

Installation &amp; Usage
------------------------

[](#installation--usage)

There are three ways to use `term-to-svg`, depending on your needs.

### Method 1: Standalone PHAR (Recommended)

[](#method-1-standalone-phar-recommended)

This method provides a single, executable file, but **requires PHP to be installed** on your system.

**Best for:** Most users, including non-developers, who want a simple way to run the tool.

1. **Download:** Grab the latest `term-to-svg.phar` file from the project's **Releases** page on GitHub.
2. **Make Executable:** Open your terminal and make the downloaded file executable. ```
    chmod +x term-to-svg.phar
    ```
3. **Run:** You can now run the tool directly. ```
    ./term-to-svg.phar -t my_session.log -i my_session.time -o output.svg
    ```

#### Making it Globally Available (Optional)

[](#making-it-globally-available-optional)

To run `term-to-svg` from any directory without typing `./term-to-svg.phar`, you can move it to a directory in your system's `PATH`.

1. **Move &amp; Rename:** Move the phar to a common location for binaries and rename it for convenience. `/usr/local/bin` is a good choice. ```
    sudo mv term-to-svg.phar /usr/local/bin/term-to-svg
    ```
2. **Verify:** Close and reopen your terminal, then check if the command is available: ```
    term-to-svg --version
    ```

If it's not found, ensure `/usr/local/bin` is in your `PATH`. You can check with `echo $PATH`. If it's missing, add it to your shell's startup file (e.g., `~/.bashrc`, `~/.zshrc`):

```
export PATH="/usr/local/bin:$PATH"
```

### Method 2: Global Install with Composer

[](#method-2-global-install-with-composer)

**Best for:** PHP developers who want the `term-to-svg` command to be available system-wide.

1. **Install:** Use Composer to install the tool globally. ```
    composer global require arthurdick/term-to-svg
    ```
2. **Update PATH:** Make sure your Composer `bin` directory is in your system's `PATH`.
3. **Run:**```
    term-to-svg -t my_session.log -i my_session.time -o output.svg
    ```

### Method 3: From Source

[](#method-3-from-source)

**Best for:** Developers who want to contribute to the project or modify the source code.

1. **Clone:** Clone the repository to your local machine. ```
    git clone https://github.com/arthurdick/term-to-svg.git
    cd term-to-svg
    ```
2. **Install Dependencies:**```
    composer install
    ```
3. **Run:** Execute the script using PHP. ```
    php bin/term-to-svg -t my_session.log -i my_session.time -o output.svg
    ```

---

The Recording Process
---------------------

[](#the-recording-process)

No matter how you installed the tool, the recording process is the same.

1. **Record:** Use the standard `script` command with the `--timing` option. ```
    script --timing=rec.time rec.log
    ```
2. **Perform Actions:** A subshell will start. Perform the commands you want to record.
3. **Exit:** When you're finished, type `exit` to end the recording session.

You will now have two files: `rec.log` (the terminal output) and `rec.time` (the timing information), ready for conversion.

---

Configuration
-------------

[](#configuration)

You can customize the output by using command-line flags. Flags will always override any settings provided by a theme.

```
Usage: term-to-svg [options]

Options:
  -t, --typescript_file   Path to the typescript file (required).
  -i, --timing_file       Path to the timing file (required).
  -o, --output_file       Path to the output SVG file (required).
  --generator     Animation generator to use (css or smil). Default: css.
  --theme             Path to a custom theme JSON file.
  --id              ID to use for the root SVG element.
  --rows            Number of terminal rows.
  --cols            Number of terminal columns.
  --font_size       Font size.
  --line_height_factor  Line height factor.
  --font_width_factor  Font width factor.
  --font_family     Font family (overrides theme).
  --default_fg         Default foreground color (overrides theme).
  --default_bg         Default background color (overrides theme).
  --animation_pause_seconds  Animation pause in seconds at the end.
  --poster_at     Generate a non-animated SVG of a single frame at a specific time or at the end.
  --interactive             Enable interactive player controls.
  -v, --version             Display the version number.
  -h, --help                Display this help message.

```

**Note on Geometry Detection**: If your `rec.log` file was generated with a `script` version that includes `COLUMNS` and `LINES` information in its first line (e.g., `COLUMNS="80" LINES="24"`), the script will automatically use these dimensions, overriding the `--rows` and `--cols` flags.

---

Theming
-------

[](#theming)

You can easily change the appearance of the output SVG by using a theme file. A number of pre-made themes are available in the `themes/` directory.

### Using a Theme

[](#using-a-theme)

To use a theme, pass the path to the theme file using the `--theme` flag:

```
./term-to-svg -t rec.log -i rec.time -o output.svg --theme themes/dracula.json
```

### Creating a Custom Theme

[](#creating-a-custom-theme)

You can create your own themes by making a JSON file with the following structure:

```
{
    "font_family": "Menlo, Monaco, \"Courier New\", monospace",
    "default_fg": "#f8f8f2",
    "default_bg": "#282a36",
    "ansi_16_colors": {
        "30": "#000000", "31": "#ff5555", "32": "#50fa7b", "33": "#f1fa8c",
        "34": "#bd93f9", "35": "#ff79c6", "36": "#8be9fd", "37": "#f8f8f2",
        "90": "#6272a4", "91": "#ff6e6e", "92": "#69ff94", "93": "#ffffa5",
        "94": "#d6acff", "95": "#ff92df", "96": "#a4ffff", "97": "#ffffff"
    }
}
```

---

Requirements
------------

[](#requirements)

- PHP 7.4 or higher.
- The `mbstring` PHP extension.
- A Unix-like operating system with the `script` command available.

---

Contributing
------------

[](#contributing)

Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.

License
-------

[](#license)

This project is licensed under the MIT License. See the `LICENSE` file for details.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance56

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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

Every ~0 days

Total

25

Last Release

325d ago

Major Versions

v2.1.0 → v3.0.02025-08-02

v3.4.1 → v4.0.02025-08-05

v4.3.1 → v5.0.02025-08-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/993782?v=4)[Arthur Dick](/maintainers/arthurdick)[@arthurdick](https://github.com/arthurdick)

---

Top Contributors

[![arthurdick](https://avatars.githubusercontent.com/u/993782?v=4)](https://github.com/arthurdick "arthurdick (114 commits)")

---

Tags

animationcliphprecordersvgterminalcliterminalsvganimationrecorder

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/arthurdick-term-to-svg/health.svg)

```
[![Health](https://phpackages.com/badges/arthurdick-term-to-svg/health.svg)](https://phpackages.com/packages/arthurdick-term-to-svg)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B13.9k](/packages/symfony-console)[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.7M301](/packages/league-climate)[php-school/cli-menu

A command line menu helper in PHP

1.9k1.2M30](/packages/php-school-cli-menu)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

5991.0M15](/packages/php-tui-php-tui)[aplus/cli

Aplus Framework CLI Library

2311.7M6](/packages/aplus-cli)[splitbrain/php-cli

Easy command line scripts for PHP with opt parsing and color output. No dependencies

178866.3k32](/packages/splitbrain-php-cli)

PHPackages © 2026

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