PHPackages                             tsg/ar - 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. tsg/ar

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

tsg/ar
======

Small lib for handling GNU ar files (i.e. .deb files)

17PHP

Since Sep 2Pushed 11y ago3 watchersCompare

[ Source](https://github.com/thesilvervestgroup/ar)[ Packagist](https://packagist.org/packages/tsg/ar)[ RSS](/packages/tsg-ar/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AR archive file handling
========================

[](#ar-archive-file-handling)

Opening, reading and creating AR archives (like .deb files) in PHP

Usage
-----

[](#usage)

### Reading

[](#reading)

Create a reader object:

```
$ar = \Tsg\Ar\Reader::open('/path/to/file');

```

Get a list of files inside archive:

```
$list = $ar->ls();

```

This returns an array of files in format:

```
$list = [ 'filename' => [ 'fpos' => position in file, 'size' => size in bytes, 'uid' => user ID, 'gid' => group ID, 'mode' => file mode ] , ... ];

```

Retrieve a file's contents from inside archive:

```
$data = $ar->get('filename');

```

This returns the data read directly from the file as found in the ls() method above. You can directly write this data to disk using fwrite() or file\_put\_contents()

### Writing

[](#writing)

Create a writer object:

```
$ar = \Tsg\Ar\Writer::create('/path/to/file');

```

Add a file to it:

```
$ar->add('/path/to/file');

```

Or add multiple files at once using a glob:

```
$ar->add('/path/to/files/*');

```

Or chain add files!

```
$ar->add('1.file')->add('2.file')->add('3.file');

```

Then close the file

```
$ar->close();

```

After the file is closed, it is ready to be used as a standard ar archive. You can confirm it's been written using the `ar` tool.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6235f38b98a4836da0f6ae3a3ea8c805df0d8f75deae002b42612db97c4e2240?d=identicon)[silvervest](/maintainers/silvervest)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/tsg-ar/health.svg)

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

###  Alternatives

[danielstjules/sliceable-stringy

Python string slices in PHP

4751.6k1](/packages/danielstjules-sliceable-stringy)[hunternnm/laravel-roadrunner

Bridge for high-performance PHP application server - RoadRunner

471.2k](/packages/hunternnm-laravel-roadrunner)

PHPackages © 2026

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