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: axelitus/base
- Root Namespace: axelitus\Base
- Author: Axel Pardemann ([email protected])
- Repository: axelitus/php-base at GitHub
- Build Status (master):
- Build Status (develop):
- Composer Package: axelitus/base at Packagist
- Issue Tracker: axelitus/php-base Issue Tracker at GitHub
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).
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.
- 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.
- 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.
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):
- Download composer if you haven't already done so (use your preferred method). Example:
$ curl -s https://getcomposer.org/installer | php
- Place a
require
statement inside yourcomposer.json
file replacing<version>
with the desired version. Example:
"require": {
"axelitus/base": "<version>"
}
- Run the composer installer to resolve dependencies and download the packages. Example:
$ php composer.phar install
- 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';
- Finally just use the package classes as needed:
axelitus\Base\[<sub-namespace>\...]<class>::<function>(<params>);