PHPackages                             fg/nokogiri - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. fg/nokogiri

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

fg/nokogiri
===========

Cuts through XML like a breeze.

2.0.0(2y ago)247.6k↓35.3%1[1 PRs](https://github.com/felixgirault/nokogiri/pulls)MITPHPPHP ^8CI passing

Since Feb 5Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/felixgirault/nokogiri)[ Packagist](https://packagist.org/packages/fg/nokogiri)[ Docs](https://github.com/felixgirault/nokogiri)[ RSS](/packages/fg-nokogiri/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (10)Used By (0)

Nokogiri
========

[](#nokogiri)

Cuts through XML like a breeze.

Examples
--------

[](#examples)

Given this XML:

```

	Lorem ipsum dolor sit amet.

```

Cutting it at the twentieth character...

```
$Nokogiri = new Nokogiri\Nokogiri();
$Nokogiri->cut($xml, 20);
```

Would return:

```

	Lorem ipsum dolor sit

```

Cutting it at the eleventh character...

```
$Nokogiri->cut($xml, 11);
```

Would return:

```

	Lorem ipsum

```

Note that the blank characters between tags are not taken into account.

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

[](#contributing)

### Installation

[](#installation)

Clone the project and run `composer install`.

### Running tests

[](#running-tests)

Run tests with `composer run-script test`.

Notes
-----

[](#notes)

The implementation is probably shitty, as I don't know anything about writing a decent parser...

Also, the implementation of the parser itself is kind of tied to the class using it. It is obviously bad but it works 😁

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance53

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 81.3% 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 ~669 days

Recently: every ~836 days

Total

6

Last Release

769d ago

Major Versions

0.3.1 → 1.0.02020-03-09

1.0.0 → 2.0.02024-04-09

PHP version history (2 changes)1.0.0PHP ^7

2.0.0PHP ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/26f691693475a607d34041944521103f6bfb1ca8f6e92606168354f84e1356ac?d=identicon)[fg](/maintainers/fg)

---

Top Contributors

[![felixgirault](https://avatars.githubusercontent.com/u/1544510?v=4)](https://github.com/felixgirault "felixgirault (13 commits)")[![manuhabitela](https://avatars.githubusercontent.com/u/221253?v=4)](https://github.com/manuhabitela "manuhabitela (3 commits)")

---

Tags

cuthtmlphptruncate-htmlxmlxmltruncatecut

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fg-nokogiri/health.svg)

```
[![Health](https://phpackages.com/badges/fg-nokogiri/health.svg)](https://phpackages.com/packages/fg-nokogiri)
```

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[sabre/xml

sabre/xml is an XML library that you may not hate.

52832.2M131](/packages/sabre-xml)

PHPackages © 2026

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