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

AbandonedArchivedLibrary

techdivision/lang
=================

Lang package implementation providing basic PHP datatypes.

0.1.9(11y ago)23.3k13OSL-3.0PHPPHP &gt;=5.4.0

Since Jul 11Pushed 11y ago11 watchersCompare

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

READMEChangelog (1)Dependencies (3)Versions (11)Used By (3)

TechDivision\_Lang
==================

[](#techdivision_lang)

[![Latest Stable Version](https://camo.githubusercontent.com/55b993d6d98ea500bad8c77f234bdb40b5edd2c1e8eb79ec49009c673ab09165/68747470733a2f2f706f7365722e707567782e6f72672f746563686469766973696f6e2f6c616e672f762f737461626c652e706e67)](https://packagist.org/packages/techdivision/lang) [![Total Downloads](https://camo.githubusercontent.com/1876be8d4eb5b2ee26837fe0588e1925ce18253c7a1141213eba4e8811e4d7fc/68747470733a2f2f706f7365722e707567782e6f72672f746563686469766973696f6e2f6c616e672f646f776e6c6f6164732e706e67)](https://packagist.org/packages/techdivision/lang) [![Latest Unstable Version](https://camo.githubusercontent.com/afb06786d24d099d8af26f5e336a048275d94558cd114ff628aa3741bbb26ca7/68747470733a2f2f706f7365722e707567782e6f72672f746563686469766973696f6e2f6c616e672f762f756e737461626c652e706e67)](https://packagist.org/packages/techdivision/lang) [![License](https://camo.githubusercontent.com/b7b4c1809cbb60b8ec8359a41571d668c177fb932141110bdbd9efe8a748c9c7/68747470733a2f2f706f7365722e707567782e6f72672f746563686469766973696f6e2f6c616e672f6c6963656e73652e706e67)](https://packagist.org/packages/techdivision/lang) [![Build Status](https://camo.githubusercontent.com/65794beab7aefc05b65554048c30a72f8adb8c62c5871f9b8528c0ee1103d688/68747470733a2f2f7472617669732d63692e6f72672f746563686469766973696f6e2f546563684469766973696f6e5f4c616e672e706e67)](https://travis-ci.org/techdivision/TechDivision_Lang)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8d2dac44d6c8b17d1013e85b912407026be44a110824df4f3aeaebba163ed2cc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746563686469766973696f6e2f546563684469766973696f6e5f4c616e672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/techdivision/TechDivision_Lang/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/40e31ac168184ef0b59dffd1dcf8134f2585f26219ebdadd4176cd1ba94a1dfd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746563686469766973696f6e2f546563684469766973696f6e5f4c616e672f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/techdivision/TechDivision_Lang/?branch=master)

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

[](#introduction)

This package provides implementation of basic PHP datatypes.

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

[](#installation)

If you want to use the library with your application you can install it by adding

```
{
    "require": {
        "techdivision/lang": "dev-master"
    },
}
```

to your `composer.json` and invoke `composer update` in your project.

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 allof those nice possibilities languages like Java provides, but as PHP is not Java, you always have to find a neat way for implementing similar things in a way it makes sense in a PHP environment.

The intention for implementing that classes was the possiblity to make your critical functions and methods type safe, by using them for type hints on the one hand and the possiblity to have an quick and easy to use kind of data validation mechanism on the other.

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 regularily.

The data type implementations this library will provide, are

- Object
- Boolean
- Integer
- Float
- String

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.

### Object

[](#object)

The abstract class `Object` 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 anonther one or try to instanciate 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
```

### Float

[](#float)

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

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

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

### String

[](#string)

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

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

// check that String was successfully concatenated
echo $string->concat(new String(' 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)
- Documentation on [GitHub](https://github.com/techdivision/TechDivision_AppserverDocumentation)
- [Getting started](https://github.com/techdivision/TechDivision_AppserverDocumentation/tree/master/docs/getting-started)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.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 ~12 days

Total

10

Last Release

4217d ago

### Community

Maintainers

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

![](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 (36 commits)")[![wick-ed](https://avatars.githubusercontent.com/u/4931168?v=4)](https://github.com/wick-ed "wick-ed (5 commits)")[![zelgerj](https://avatars.githubusercontent.com/u/287595?v=4)](https://github.com/zelgerj "zelgerj (2 commits)")

---

Tags

basic datatypes objects boolean string float integer

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[appserver-io/lang

Lang package implementation providing basic PHP datatypes.

1414.2k10](/packages/appserver-io-lang)

PHPackages © 2026

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