PHPackages                             norse-blue/prim - 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. norse-blue/prim

Abandoned → [norse-blue/scalar-objects](/?search=norse-blue%2Fscalar-objects)ArchivedLibrary

norse-blue/prim
===============

PHP Primitive Objects

0.2.0(6y ago)28MITPHPPHP ^7.3

Since May 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/norse-blue/php-prim)[ Packagist](https://packagist.org/packages/norse-blue/prim)[ Docs](https://norse.blue/open-source/php-prim)[ RSS](/packages/norse-blue-prim/feed)WikiDiscussions master Synced 2mo ago

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

PHP Primitive Objects
=====================

[](#php-primitive-objects)

 [![Build Status](https://camo.githubusercontent.com/3df27acc340c8bcfe0a7267d419bd4238b3a5c149725bb4e331dce8c36704a97/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f6e6f7273652d626c75652f7068702d7072696d2f6d61737465722e7376673f636f6c6f723d253233613362653863267374796c653d706f706f75742d737175617265)](https://circleci.com/gh/norse-blue/php-prim/tree/master) [![PHP Version](https://camo.githubusercontent.com/4d3386ddafd42eb2480afbbbfcce8f402e7ec9a73cc0416548528a2a0235a1a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e6f7273652d626c75652f7072696d2e7376673f636f6c6f723d253233623438656164267374796c653d706f706f75742d737175617265)](https://php.net/releases) [![Stable Release](https://camo.githubusercontent.com/b583d125d9adf03c0d39e07a2193b5b26d867cd666f7674e3f46b0a2a8791069/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f7273652d626c75652f7072696d2e7376673f636f6c6f723d253233356538316163267374796c653d706f706f75742d737175617265)](https://packagist.org/packages/norse-blue/prim) [![](https://camo.githubusercontent.com/9e36092550ff7679458722eda020b3b3bef5df11779f83ebdb1b6bcee72819a1/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35313139356563336134376138623037313338312f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/norse-blue/php-prim/maintainability) [![](https://camo.githubusercontent.com/3f140145dee5cc6c1822006b05e824b53a3c57e19abfde6ef808606f16f594df/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35313139356563336134376138623037313338312f746573745f636f766572616765)](https://codeclimate.com/github/norse-blue/php-prim/test_coverage) [![Total Downloads](https://camo.githubusercontent.com/31e6b14a373b16360444efb274c8651562d5217b216c7755fdbf77645544137e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f7273652d626c75652f7072696d2e7376673f636f6c6f723d253233356538316163267374796c653d706f706f75742d737175617265)](https://packagist.org/packages/norse-blue/prim) [![GitHub](https://camo.githubusercontent.com/0eb5df7ca2816ac8c8f78b5688e709d44be11a20b3754aa1cfc774b8a56814d0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e6f7273652d626c75652f7068702d7072696d2e7376673f636f6c6f723d253233356538316163267374796c653d706f706f75742d737175617265)](https://packagist.org/packages/norse-blue/prim)

---

**DEPRECATED:** This package was growing too big and has now been deprecated in favor of the following smaller, segmented and more contained packages:

- [norse-blue/collection-objects](https://github.com/norse-blue/php-collection-objects)
- [norse-blue/enum-objects](https://github.com/norse-blue/php-enum-objects)
- [norse-blue/extensible-objects](https://github.com/norse-blue/php-extensible-objects)
- [norse-blue/handy-properties](https://github.com/norse-blue/php-handy-properties)
- [norse-blue/optionals](https://github.com/norse-blue/php-optionals)
- [norse-blue/scalar-objects](https://github.com/norse-blue/php-scalar-objects)
- [norse-blue/value-objects](https://github.com/norse-blue/php-value-objects)

**PHP Prim** is a PHP library that exposes primitive types as immutable objects with convenience methods to operate on them.

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

[](#installation)

> Requirements:
>
> - [PHP 7.3+](https://php.net/releases)
> - [BC Math](https://www.php.net/manual/book.bc.php) extension (for UUIDs)
> - [JSON](https://www.php.net/manual/book.json.php) extension
> - [Multibyte String](https://www.php.net/manual/book.mbstring.php) extension

Install Prim using Composer:

```
composer require norse-blue/prim
```

Usage
-----

[](#usage)

There are three ways to create a primitive object instance:

1. Using the `new` keyword:

    ```
    use NorseBlue\Prim\Scalars\StringObject as Str;

    $str = new Str('my string');
    echo $str->upper();

    // Outputs:
    // MY STRING
    ```
2. Using the facades:

    ***Note:** params passed by reference are not supported in facades because the calls depend on `__callStatic`, which does not pass params by reference. See [Overloading](https://www.php.net/manual/en/language.oop5.overloading.php).*

    ```
    use NorseBlue\Prim\Facades\Scalar\StringFacade as Str;

    echo Str::upper('my string');

    // Outputs:
    // MY STRING
    ```
3. Using the namespaced functions:

    ```
    use NorseBlue\Prim\string;

    $str = string('my string');
    echo $str->upper();

    // Outputs:
    // MY STRING
    ```

You can also chain methods together:

```
use NorseBlue\Prim\string;

$str = string('THIS IS MY TEXT.')->lower()->ucfirst();
echo $str;

// Outputs:
// This is my text.
```

You don't need to worry about side-effects for scalar objects, as they are implemented as immutable objects and each method returns a new object. To store the value don't forget to assign it to a variable or it will be lost.

Documentation
-------------

[](#documentation)

For the full documentation refer to the [docs](docs) folder.

Changelog
---------

[](#changelog)

Please refer to the [CHANGELOG.md](CHANGELOG.md) file for more information about what has changed recently.

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

[](#contributing)

Contributions to this project are accepted and encouraged. Please read the [CONTRIBUTING.md](.github/CONTRIBUTING.md)file for details on contributions.

Credits
-------

[](#credits)

- [Axel Pardemann](https://github.com/axelitus)
- [All Contributors](../../contributors)

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Support the development
-----------------------

[](#support-the-development)

**Do you like this project? Support it by donating**

[ ![Buy me a coffee](.assets/buy-me-a-coffee.svg)](https://www.buymeacoffee.com/axelitus)License
-------

[](#license)

PHP Prim is open-sourced software licensed under the [MIT](LICENSE.md) license.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

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

Total

2

Last Release

2546d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/61386558d4fa03cc9de21d20e76f396d5568e0e647e1cdf18f12c87f1a5f87b5?d=identicon)[axelitus](/maintainers/axelitus)

![](https://www.gravatar.com/avatar/848678ae5df09575d50a2817e573c114ab2255eeb9593b6c9de741fe4f8d0f64?d=identicon)[NorseBlue](/maintainers/NorseBlue)

---

Top Contributors

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

---

Tags

dataobjectprimitivedata-typesscalars

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/norse-blue-prim/health.svg)

```
[![Health](https://phpackages.com/badges/norse-blue-prim/health.svg)](https://phpackages.com/packages/norse-blue-prim)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M302](/packages/doctrine-mongodb-odm)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[doctrine/phpcr-odm

PHP Doctrine Content Repository Object Document Mapper (ODM) provides transparent persistence for PHP objects.

1811.5M97](/packages/doctrine-phpcr-odm)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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