axelitus/base

This package is abandoned and no longer maintained. The author suggests using the norse-blue/scalar-objects package instead.

A framework agnostic PHP package that contains _extensions_ and helpers for the PHP primitive types (strings, numbers, array, etc.). It also contains common interfaces for _new_ types like collections, etc.

0.9 2015-03-29 20:11 UTC

This package is auto-updated.

Last update: 2022-02-01 12:26:30 UTC


README

A framework agnostic PHP package that contains extensions and helpers for the PHP primitive types (strings, numbers, array, etc.). It also contains common interfaces for new types like dot-notated arrays, collections, etc.

Package Information

Requirements

The requirements for this package to work are the following:

  • PHP >= 5.4.9 (it may work for previous 5.4.X versions but it is not tested).

Standards

This package is intended to follow some standards for easy contributions and usage. Recently there has been an initiative to standardize the interoperation of frameworks, though I think this easily extends to most pieces of code everyone is building. The group behind all this is the PHP-FIG (Framework Interoperability Group), you should pay them a visit at their site.

There are already some standards marked as accepted (final): PSR-0, PSR-1, PSR-2, PSR-3, PSR-4.

This package is intended to be PSR-2/PSR-4 compliant.

Being PSR-2/PSR-4 compliant means this package follows a guide for coding styles and the developers and contributors should enforce this for everyone's benefit. It also means that it can be easily installed by using Composer from the Packagist package archive. Just follow the instructions in section How to install.

Contents

axelitus\Base
  • Arr - Dot-notated array object.
  • BigFloat - Float operations for big numbers.
  • BigInt - Int operations for big numbers.
  • BigNum - Numeric operations for big numbers.
  • Bool - Boolean operations.
  • BoolAnd - Boolean AND operations on values and arrays.
  • BoolEq - Boolean EQ operations on values and arrays.
  • BoolNot - Boolean NOT operations on values and arrays.
  • BoolOr - Boolean OR operations on values and arrays.
  • BoolXor - Boolean XOR operations on values and arrays.
  • Comparable - Defines the interface for a comparable object.
  • Comparer - Simple and flexible base comparer from which new comparers should be derived.
  • DotArr - Dot-notated array operations.
  • Flag - Bitwise flag operations.
  • Float - Float operations.
  • Initiable - Defines the interface for initiable classes (simulates a static constructor).
  • Int - Int operations.
  • Num - Numeric operations.
  • PropertyAccessible - Allows derived class to use object property access syntax just be defining getters and setters.
  • Str - String operations.
  • Traverser - Array callback traverser.
axelitus\Base\Comparison
  • BigFloatComparer - BigFloat comparer implementation.
  • BigIntComparer - BigInt comparer implementation.
  • BigNumComparer - BigNum comparer implementation.
  • BoolComparer - Bool comparer implementation.
  • FloatComparer - Float comparer implementation.
  • IntComparer - Int comparer implementation.
  • StrComparer - Str comparer implementation.

How to install

To install this package and use it in your app just follow these instructions (if you haven't read the documentation from Composer please do so before you continue):

  1. Download composer if you haven't already done so (use your preferred method). Example:
    $ curl -s https://getcomposer.org/installer | php
  1. Place a require statement inside your composer.json file replacing <version> with the desired version. Example:
    "require": {
        "axelitus/base": "<version>"
    }
  1. Run the composer installer to resolve dependencies and download the packages. Example:
    $ php composer.phar install
  1. In order to use the packages you have to load the autoloader that was generated by composer (if you are using a framework, maybe this is already done automatically). Example:
    require 'vendor/autoload.php';
  1. Finally just use the package classes as needed:
    axelitus\Base\[<sub-namespace>\...]<class>::<function>(<params>);