PHPackages                             appserver-io/lang - 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. appserver-io/lang

ActiveLibrary

appserver-io/lang
=================

Lang package implementation providing basic PHP datatypes.

5.0.0(7y ago)1414.2k14[1 PRs](https://github.com/appserver-io/lang/pulls)9OSL-3.0PHPPHP &gt;=5.4.0

Since Nov 21Pushed 7y ago3 watchersCompare

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

READMEChangelogDependencies (2)Versions (20)Used By (9)

PHP language extension
======================

[](#php-language-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/6ad2e2d7a7263ad7347b4b0a872b5b4eaaaadab68b6e0cc9f817fb883128d92b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6170707365727665722d696f2f6c616e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/appserver-io/lang)[![Total Downloads](https://camo.githubusercontent.com/add9d88c20ef1b05fc13133f586886cbf18c4f353b33a5f6dd722fe5546ccd5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6170707365727665722d696f2f6c616e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/appserver-io/lang)[![License](https://camo.githubusercontent.com/ddae27eb26b1ccfb8b9bb5d40e19813677e82a220ca0d21758bfd554d329a26e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6170707365727665722d696f2f6c616e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/appserver-io/lang)[![Build Status](https://camo.githubusercontent.com/a155f8ad04f670df1832790593ccbbec8bd171ce78a4e7b693263ddb3a6c081a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6170707365727665722d696f2f6c616e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](http://travis-ci.org/appserver-io/lang)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9051da965b7117833efbf01d3baf00317ab491afeac4a5d94608d08bc302dbdf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6170707365727665722d696f2f6c616e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/appserver-io/lang/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c3425951c6007f95882353106cbfccb5abbbe8c7eac0328f3ad4229399ad076f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6170707365727665722d696f2f6c616e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/appserver-io/lang/?branch=master)

Introduction
------------

[](#introduction)

This package provides implementation of basic PHP datatypes.

Issues
------

[](#issues)

In order to bundle our efforts we would like to collect all issues regarding this package in [the main project repository's issue tracker](https://github.com/appserver-io/appserver/issues). Please reference the originating repository as the first element of the issue title e.g.: `[appserver-io/] A issue I am having`

Usage
-----

[](#usage)

This package provides classes representing an object oriented implementation for some basic datatypes.

As there has been (and still are) many discussions about PHP and type safety i decided to implement a small, really basic library that will offer the most basic datatype needed in nearly every project. To be honest, I really like almost all of those nice possibilities languages like Java provides, but as PHP is not Java, you always have to find a neat way to implement similar things in a way that makes sense in a PHP environment.

The intention for implementing those classes was the possibility to make your critical functions and methods Type-Safe, by using them for type hinting on one hand and the possibility to have a quick and easy to use kind of data validation mechanism on the other hand.

As you may know, using type hints will probably slow down your code a bit, so take care when you use them and always have an eye on possible performance impacts by running performance tests regularly.

The data type implementations this library will provide, are

- Objct
- Boolean
- Integer
- Flt
- Strng

The following examples wil give you a short introduction about the functionality each class will provide and how you can use it in your code. Please be aware, that the examples are not intended to make any sense, they should only give you an idea what is possible.

### Objct (Object before version 5.0)

[](#objct-object-before-version-50)

The abstract class `Objct` implements a low level presentation of a class. All other classes of this library use it as superclass.

### Boolean

[](#boolean)

Using a `Boolean` instance to compare against another one or try to instantiate it with a not boolean value.

```
// initialize a new Integer instance
$bool = new Boolean(true);
$bool->equals(new Boolean(false)); // false

// throws a ClassCastException
$invalid = new Boolean('aValue');
```

### Integer

[](#integer)

Here are some examples how you can use the `Integer` class

```
// initialize a new Integer instance
$int = new Integer(17);

// get the float value of the Integer
echo $int->floatValue() . PHP_EOL; // 17.0
echo $int->stringValue() . PHP_EOL; // '17'

// check that the two Integer instances are equal
$int->equals(Integer::valueOf(new String('17'))); // true
```

### Flt (Float before version 3.0)

[](#flt-float-before-version-30)

The example for using a `Flt` shows you how to add to instances and print the float value

```
// initialize a new Float instance
$float = new Flt(10.005);
$float->add(new Flt(10.105));

// check the value
echo $float->floatValue() . PHP_EOL; // 20.11
```

### Strng (String before version 3.0)

[](#strng-string-before-version-30)

To show you how you can use the `Strng` class we'll simple concatenate to instances

```
// initialize a new String instance
$string = new Strng('value to');

// check that String was successfully concatenated
echo $string->concat(new Strng(' search')) . PHP_EOL; // 'value to search'
```

Yeah, this are really simple examples, and as i told you before in most cases i'll use that classes for simple things like type hints and so on.

If you like to use that stuff also, feel free to implement your own types and send me a pull request :)

External Links
--------------

[](#external-links)

- Documentation at [appserver.io](http://docs.appserver.io)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community28

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 65.7% 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 ~75 days

Recently: every ~207 days

Total

19

Last Release

2822d ago

Major Versions

1.0.0 → 2.0.02015-04-02

1.0.1 → 2.0.x-dev2015-05-06

1.0.x-dev → 3.0.02017-06-06

3.0.x-dev → 4.0.02017-06-06

4.0.0 → 5.0.02018-08-17

PHP version history (2 changes)0.1.9PHP &gt;=5.4.0

1.0.x-devPHP &gt;=5.4.0 &lt;7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/76b54aaecf7287a0520eec0009161ca457982dee83ac413bfa0d818b72d79947?d=identicon)[wagnert](/maintainers/wagnert)

![](https://www.gravatar.com/avatar/33b42e8c7314da5df45bca5d1dd786ea2b3d540fae5a5a9489580a886f2f4f39?d=identicon)[zelgerj](/maintainers/zelgerj)

![](https://www.gravatar.com/avatar/aa15f27f393eeb1f1a481fa7de89b41add17de686da79d49e07c5c77249c5e86?d=identicon)[wick-ed](/maintainers/wick-ed)

---

Top Contributors

[![wagnert](https://avatars.githubusercontent.com/u/287509?v=4)](https://github.com/wagnert "wagnert (44 commits)")[![wick-ed](https://avatars.githubusercontent.com/u/4931168?v=4)](https://github.com/wick-ed "wick-ed (17 commits)")[![vadimjustus](https://avatars.githubusercontent.com/u/4609608?v=4)](https://github.com/vadimjustus "vadimjustus (4 commits)")[![skafandri](https://avatars.githubusercontent.com/u/659656?v=4)](https://github.com/skafandri "skafandri (1 commits)")[![zelgerj](https://avatars.githubusercontent.com/u/287595?v=4)](https://github.com/zelgerj "zelgerj (1 commits)")

---

Tags

basic datatypes objects boolean string float integer

### Embed Badge

![Health badge](/badges/appserver-io-lang/health.svg)

```
[![Health](https://phpackages.com/badges/appserver-io-lang/health.svg)](https://phpackages.com/packages/appserver-io-lang)
```

PHPackages © 2026

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