PHPackages                             pyrech/gcode-estimator - 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. pyrech/gcode-estimator

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

pyrech/gcode-estimator
======================

Calculate filament length/weight/cost used in gcode file

v1.0.1(6y ago)156113[2 issues](https://github.com/pyrech/gcode-estimator/issues)MITPHPPHP &gt;=7.2

Since Feb 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pyrech/gcode-estimator)[ Packagist](https://packagist.org/packages/pyrech/gcode-estimator)[ RSS](/packages/pyrech-gcode-estimator/feed)WikiDiscussions main Synced 1w ago

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

GcodeEstimator
==============

[](#gcodeestimator)

GcodeEstimator is a PHP library to estimate the length/weight/cost of filament used for a 3D print through the corresponding gcode file.

Requires PHP &gt;= 7.2.

Features
--------

[](#features)

Unlike other implementations, this library supports most of g-code operations commonly used by 3d printers:

- all kind of moves (rapid, linear, clockwise arc, counter-clockwise arc)
- absolute and relative positionings
- switch between absolute/relative modes
- current position reset
- millimeter and inche units

Estimations should be quite realist whatever the slicer/printer you use.

Installation
------------

[](#installation)

Use [Composer](http://getcomposer.org/) to install GcodeEstimator in your project:

```
composer require "pyrech/gcode-estimator"
```

Usage
-----

[](#usage)

Basic usage to get the length of filament used:

```
include __DIR__.'/vendor/autoload.php';

use Pyrech\GcodeEstimator\Estimator;

$estimator = new Estimator();
$estimate = $estimator->estimate($absolutePathToGcode);

$estimate->getLength(); // returns the length of filament used (in mm);
```

You can also estimate the weight and cost of your print by describing the properties of your filament spool:

```
include __DIR__.'/vendor/autoload.php';

use Pyrech\GcodeEstimator\Estimator;
use Pyrech\GcodeEstimator\Filament;

$filament = new Filament(
    1.75, // filament diameter in mm
    1.24, // filament density in g/cm³
    750,  // weight of the spool in g
    25.99 // price of the spool (whatever your currency)
);

$estimator = new Estimator();
$estimate = $estimator->estimate($absolutePathToGcode, $filament);

$estimate->getLength(); // returns the length of filament used (in mm);
$estimate->getWeight(); // returns the weight of filament used (in g);
$estimate->getCost();   // returns the cost of filament used (in whatever currency you specified);
```

Further documentation
---------------------

[](#further-documentation)

You can see the current and past versions using one of the following:

- the `git tag` command
- the [releases page on Github](https://github.com/pyrech/gcode-estimator/releases)
- the file listing the [changes between versions](CHANGELOG.md)

And finally some meta documentation:

- [versioning and branching models](VERSIONING.md)
- [contribution instructions](CONTRIBUTING.md)

Credits
-------

[](#credits)

- [All contributors](https://github.com/pyrech/gcode-estimator/graphs/contributors)

License
-------

[](#license)

GcodeEstimator is licensed under the MIT License - see the [LICENSE](LICENSE)file for details.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

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 ~2 days

Total

2

Last Release

2276d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c177e9f7e88fba40b24b047954fe1ff793d48c2bd8bb12bb2e412aa9ea633ede?d=identicon)[pyrech](/maintainers/pyrech)

---

Top Contributors

[![pyrech](https://avatars.githubusercontent.com/u/2021641?v=4)](https://github.com/pyrech "pyrech (17 commits)")

---

Tags

3d3d-printingcostfilamentgcodelengthweightprinterheightfilamentlengthcost3destimate3d-print

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/pyrech-gcode-estimator/health.svg)

```
[![Health](https://phpackages.com/badges/pyrech-gcode-estimator/health.svg)](https://phpackages.com/packages/pyrech-gcode-estimator)
```

###  Alternatives

[mjaschen/phpgeo

Simple Yet Powerful Geo Library

1.6k8.6M22](/packages/mjaschen-phpgeo)[mike42/escpos-php

PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers

2.7k1.9M22](/packages/mike42-escpos-php)[awcodes/filament-table-repeater

A modified version of the Filament Forms Repeater to display it as a table.

262815.1k5](/packages/awcodes-filament-table-repeater)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

320392.1k17](/packages/codewithdennis-filament-select-tree)[pxlrbt/filament-environment-indicator

Indicator for the current environment inside Filament

151923.9k12](/packages/pxlrbt-filament-environment-indicator)[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)

PHPackages © 2026

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