acid-solutions/value-objects

1,659 1
Install
composer require acid-solutions/value-objects
Latest Version:v0.0.2
PHP:>=5.3.0
Laravel:4
Last Updated:May 28, 2015
Links: GitHub  ·  Packagist
Maintainer: daniel-acid

ValueObjects

It's an easy to use bulk of classes.

Install

Classes

  • Decimal
  • String

Decimal

Provide an easy way to use Decimal numbers

$decimal = new Decimal("1");

echo $decimal; // 1.00

$decimal === 1.00; // false

$decimal->value === 1.00; // true

$decimal() === 1.00; //true

$decimal->add('3')->multiple(4)->reduce(new Decimal(1));

echo $decimal; // 15.00

// Use it in function parameter

class SomeAwesomeClass
{
    public function plusOneMaybeAndDisplay( Decimal $prettyDecimal )
    {
        if ( rand(0,1) )
        {
            $prettyDecimal->add(1);
        }

        echo $prettyDecimal;
    }
}

// Methods:
$decimal->isEqualTo(x) // Boolean
$decimal->isPositive() // Boolean
$decimal->isLowerThan(x) // Boolean
$decimal->isLowerOrEqualTo(x) // Boolean
$decimal->isHigherThan(x) // Boolean
$decimal->isHigherOrEqualTo(x) // Boolean

String

$myString = new String('a string');

$myString->upper()->contains('STRING');

// Use it in function parameter

class SomeAwesomeClass
{
    public function crazyFunction( String $sexyString )
    {
        // Do something with this fucking sexyString !
    }
}

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
v0.0.2 >=5.3.0 ~4.0
v0.0.1 >=5.3.0 ~4.0