2017 © Pedro Peláez
 

library lang

Lang package implementation providing basic PHP datatypes.

image

appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  • Monday, November 27, 2017
  • by wagnert
  • Repository
  • 4 Watchers
  • 9 Stars
  • 11,343 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 11 Forks
  • 1 Open issues
  • 19 Versions
  • 3 % Grown

The README.md

PHP language extension

Latest Stable Version Total Downloads License Build Status Scrutinizer Code Quality Code Coverage, (*1)

Introduction

This package provides implementation of basic PHP datatypes., (*2)

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. Please reference the originating repository as the first element of the issue title e.g.: [appserver-io/<ORIGINATING_REPO>] A issue I am having, (*3)

Usage

This package provides classes representing an object oriented implementation for some basic datatypes., (*4)

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., (*5)

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., (*6)

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., (*7)

The data type implementations this library will provide, are, (*8)

  • 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., (*9)

Objct (Object before version 5.0)

The abstract class Objct implements a low level presentation of a class. All other classes of this library use it as superclass., (*10)

Boolean

Using a Boolean instance to compare against another one or try to instantiate it with a not boolean value., (*11)

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

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

Integer

Here are some examples how you can use the Integer class, (*12)

// 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)

The example for using a Flt shows you how to add to instances and print the float value, (*13)

// 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)

To show you how you can use the Strng class we'll simple concatenate to instances, (*14)

// 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., (*15)

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

The Versions

27/11 2017

dev-master

9999999-dev https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

07/06 2017

4.0.0

4.0.0.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

07/06 2017

3.0.x-dev

3.0.9999999.9999999-dev https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

07/06 2017

3.0.0

3.0.0.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

10/05 2016

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

06/05 2015

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

02/04 2015

1.0.1

1.0.1.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

02/04 2015

2.0.0

2.0.0.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

13/02 2015

1.0.0

1.0.0.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

11/02 2015

0.1.18

0.1.18.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

28/01 2015

0.1.17

0.1.17.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

20/01 2015

0.1.16

0.1.16.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

17/01 2015

0.1.15

0.1.15.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

09/01 2015

0.1.14

0.1.14.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

09/01 2015

0.1.13

0.1.13.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

12/12 2014

0.1.12

0.1.12.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

03/12 2014

0.1.11

0.1.11.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

02/12 2014

0.1.10

0.1.10.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer

21/11 2014

0.1.9

0.1.9.0 https://github.com/appserver-io/lang

Lang package implementation providing basic PHP datatypes.

  Sources   Download

OSL-3.0

The Requires

 

The Development Requires

basic datatypes objects boolean string float integer