PHPackages                             kleinweb/lib - 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. kleinweb/lib

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

kleinweb/lib
============

The source code for the Klein College standard library

2.0.0(1mo ago)11.0k↓87.5%[1 issues](https://github.com/kleinweb/lib/issues)[6 PRs](https://github.com/kleinweb/lib/pulls)2GPL-3.0-or-laterPHPPHP ^8.3CI passing

Since Sep 24Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/kleinweb/lib)[ Packagist](https://packagist.org/packages/kleinweb/lib)[ Docs](https://github.com/kleinweb/lib)[ RSS](/packages/kleinweb-lib/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (40)Versions (31)Used By (2)

Kleinweb Standard Library
=========================

[](#kleinweb-standard-library)

A PHP library providing shared functionality for WordPress-based applications at Klein College (Temple University). Built on [Roots Acorn](https://roots.io/acorn/) to bring Laravel-style service providers, dependency injection, and Blade templating to WordPress.

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

[](#requirements)

- PHP 8.2+
- WordPress with [Roots Acorn](https://roots.io/acorn/) 5.x

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

[](#installation)

```
composer require kleinweb/lib
```

Features
--------

[](#features)

### Attribute-Based WordPress Hooks

[](#attribute-based-wordpress-hooks)

Register actions and filters declaratively using PHP 8 attributes:

```
use Kleinweb\Lib\Hooks\Attributes\Action;
use Kleinweb\Lib\Hooks\Attributes\Filter;
use Kleinweb\Lib\Support\ServiceProvider;

class MyServiceProvider extends ServiceProvider
{
    #[Action('init')]
    public function onInit(): void
    {
        // Runs on WordPress 'init' action
    }

    #[Filter('the_content', priority: 20)]
    public function filterContent(string $content): string
    {
        return $content . 'Appended content';
    }
}
```

### Package Configuration

[](#package-configuration)

Fluent API for defining package assets, adapted from [spatie/laravel-package-tools](https://github.com/spatie/laravel-package-tools):

```
use Kleinweb\Lib\Package\Package;
use Kleinweb\Lib\Package\PackageServiceProvider;

class MyPackageServiceProvider extends PackageServiceProvider
{
    public function configurePackage(Package $package): void
    {
        $package
            ->name('my-package')
            ->hasConfigFile()
            ->hasViews()
            ->hasMigrations('create_items_table')
            ->hasCommands(MyCommand::class);
    }
}
```

### Multisite Utilities

[](#multisite-utilities)

Helpers for WordPress multisite environments:

```
use Kleinweb\Lib\Tenancy\Site;

Site::name();                    // Current site name
Site::url();                     // Site URL as League\Uri instance
Site::host();                    // Current hostname
Site::isPrimaryHost();           // Check if on main site
Site::originalHost();            // Get original domain from site meta
```

### Logging Integration

[](#logging-integration)

Monolog handler for [Simple History](https://wordpress.org/plugins/simple-history/) plugin:

```
use Kleinweb\Lib\Log\SimpleHistoryHandler;
use Monolog\Logger;

$logger = new Logger('my-channel');
$logger->pushHandler(new SimpleHistoryHandler());
```

Development
-----------

[](#development)

This project uses [Nix](https://nixos.org/) for reproducible development environments and [just](https://just.systems/) for task automation.

```
# Enter development shell (if using Nix)
nix develop

# Or use direnv
direnv allow

# Run all checks
just check

# Lint only
just lint

# Auto-fix issues
just fix

# Individual tools
composer phpstan    # Static analysis (level 8)
composer phpcs      # Code sniffer
composer phpcbf     # Auto-fix code sniffer issues
```

License
-------

[](#license)

GPL-3.0-or-later

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance69

Regular maintenance activity

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% 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 ~26 days

Total

21

Last Release

56d ago

Major Versions

0.7.1 → 1.0.02026-01-13

1.2.0 → 2.0.02026-04-28

PHP version history (2 changes)0.1.0PHP ^8.2

0.7.1PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![astratagem](https://avatars.githubusercontent.com/u/1757914?v=4)](https://github.com/astratagem "astratagem (124 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (3 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/kleinweb-lib/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M462](/packages/pimcore-pimcore)[php-soap/wsdl

Deals with WSDLs

183.8M18](/packages/php-soap-wsdl)[laravel/nightwatch

The official Laravel Nightwatch package.

3588.7M31](/packages/laravel-nightwatch)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)

PHPackages © 2026

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