PHPackages                             christianberkman/sortable-book - 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. christianberkman/sortable-book

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

christianberkman/sortable-book
==============================

Make the title and author sortable for use in a library inventory by moving the article and initials to the end of the string

1.0.1(1y ago)010MITPHP

Since Dec 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/christianberkman/sortable-book)[ Packagist](https://packagist.org/packages/christianberkman/sortable-book)[ RSS](/packages/christianberkman-sortable-book/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Sortable Book
=============

[](#sortable-book)

Make the title and author sortable for use in a library inventory by moving the article and initials to the end of the string.

This package contains does not contain a class but two helper functions `sortableAuthor()` and `sortableTitle()`.sw

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

[](#installation)

### Via Composer

[](#via-composer)

```
composer require chhristianberkman/sortable-book
```

The file `sortable-book.php` will be autoloaded.

### Manually

[](#manually)

```
require('src/sortable-book.php');
```

Usage
-----

[](#usage)

```
$author = sortableAuthor('C.S. Lewis');
// Lewis, C.S.

$title = sortableTitle('The Last Battle');
// Last Battle, The
```

Function reference
------------------

[](#function-reference)

### sortableAuthor(*?string $value*): ?string

[](#sortableauthorstring-value-string)

Make a book author sortable by moving initials to the end of the string, preceded by a comma and a space

- `string $value` string to format

### sortableTitle(*?string $value, bool $makeSingleSpaces = true, ?string $articles = 'a|an|the'* ): ?string

[](#sortabletitlestring-value-bool-makesinglespaces--true-string-articles--aanthe--string)

Make a book title sortable by moving tha article to the end of the string, preceded by a comma and a space.

- `string $value` string to format
- `bool $makeSingleSpaces` convert all whitepaces to a single whitespace
- `string $articles` list of articles seperated by `|`, defaults to 'a|an|the'

*Returns* `string` or `null`

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance42

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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

Every ~4 days

Total

2

Last Release

493d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/christianberkman-sortable-book/health.svg)

```
[![Health](https://phpackages.com/badges/christianberkman-sortable-book/health.svg)](https://phpackages.com/packages/christianberkman-sortable-book)
```

PHPackages © 2026

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