jgswift / restructr
PHP 5.5+ domain component foundation
Installs: 226
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jgswift/restructr
Requires
- php: >=5.5
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2025-10-21 21:30:13 UTC
README
domain component foundation
Installation
Install via cli using composer:
php composer.phar require jgswift/restructr:0.1.*
Install via composer.json using composer:
{
"require": {
"jgswift/restructr": "0.1.*"
}
}
Dependency
- php 5.5+
Description
restructr provides a set of foundational component abstractions in order to facilitate domain driven development in PHP. With no exception, the component foundation classes are composed at compile-time by traits, allowing a flexible approach that requires little imposition on an already existing domain model. restructr provides these domain driven abstractions from both array-first or object-first perspectives. restructr assumes very little about any given domains implementation and allows significant customization of existing functionality.
Component Abstractions
Entity- A single identifiable componentCollection- A collection ofEntitycomponentsValueArray- An immutableArrayAccess(offsetGet,offsetSet, etc..)ValueObject- An immutableObjectAccess(__get,__set, etc..)CollectionEntity- AnEntitycomponent that also accepts/serializes an innerCollectionCollectionIterator- ACollectionof non-accessable but iterableEntitycomponents.EntityIterator- AEntityof non-accessable but iterable domain data
As mentioned above, it is possible to include these concepts into an already existing domain without extending the provided abstractions. Nearly all abstractions are provided as composable traits that may be used or combined in any number of ways.
Trait Extensions
These traits are included to customize domain implementations in various ways. Some of these are foundational to the provided component abstractions, while others may be excluded or included on a per-domain basis.
ArrayAccess- SPLArrayAccessimplementation using local domain dataArrayAggregate- SPLIteratorAggregateimplementation using local domain dataArrayAttributable-ArrayAccesskey restraints as defined bygetAttributesmethodArrayEnumerable-Enumerableimplementation to retrieve local domain dataArrayEnumerableAggregate- SPLIterateAggregateimplementation usingEnumerabledataArrayImmutable-ArrayAccessimplementation that disallows mutation (offsetSet,offsetUnset)ArrayIterator- SPLIteratorimplementation using local domain dataCountable- SPLCountableimplementation using local domain dataObjectAccess- Object magic implementation based onArrayAccesstraitObjectAttributable-ObjectAccessproperty restraints as defined bygetAttributesmethodObjectEnumerable-ArrayEnumerablealiasObjectImmutable-ObjectAccessimplementation that disallows property mutation (__set,__unset)RecursiveArrayIterator- SPLRecursiveIteratorimplementation that uses RecursiveArrayIterator from SPLRecursiveIterator- Minimal SPLRecursiveIteratorimplementationRecursiveSerializer-Enumerableimplementation that recursively converts domain data to an array