Download the PHP package azaharizaman/nexus-common without Composer

On this page you can find all versions of the php package azaharizaman/nexus-common. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nexus-common

Nexus Common

Shared domain primitives, contracts, and value objects for Nexus packages.

The Common package contains foundational elements that are shared across multiple Nexus packages, ensuring consistent domain modeling and reducing code duplication.

Overview

This package provides:

Installation

Package Contents

Value Objects (src/ValueObjects/)

Core Value Objects

Value Object Interfaces Description
TenantId Comparable, SerializableVO Strongly-typed tenant identifier (ULID)
Money Comparable, Addable, Subtractable, Multipliable, Divisible, CurrencyConvertible, SerializableVO, Formattable Immutable monetary value with precision arithmetic
Percentage Comparable, Addable, Subtractable, Multipliable, Divisible, SerializableVO, Formattable Percentage values (0-100) for taxes, discounts, variance

Measurement Value Objects

Value Object Interfaces Description
UnitOfMeasurement Enumable, SerializableVO Standard measurement units (kg, m, L, pcs, etc.)
Measurement Comparable, Addable, Subtractable, Multipliable, Divisible, Convertible, SerializableVO, Formattable Measurements with unit conversion
Quantity Comparable, Addable, Subtractable, Multipliable, Divisible, Convertible, SerializableVO Discrete quantities with units

Identifier Value Objects

Value Object Interfaces Description
EntityId Comparable, SerializableVO Base class for strongly-typed ULID identifiers
CustomerId Comparable, SerializableVO Customer identifier
ProductId Comparable, SerializableVO Product identifier
EmployeeId Comparable, SerializableVO Employee identifier
VendorId Comparable, SerializableVO Vendor identifier
WarehouseId Comparable, SerializableVO Warehouse identifier

Contact Information Value Objects

Value Object Interfaces Description
Email Comparable, SerializableVO Validated email address with domain extraction
PhoneNumber Comparable, SerializableVO International phone number (E.164 format)
Address Comparable, SerializableVO Physical address with country validation

Temporal Value Objects

Value Object Interfaces Description
DateRange Comparable, Temporal, AdjustableTime, SerializableVO Date period with overlap detection
AuditMetadata Auditable, SerializableVO Created/updated by and timestamps

Financial Value Objects

Value Object Interfaces Description
TaxRate Comparable, Multipliable, SerializableVO Tax rate with jurisdiction and effectivity
TaxCode Comparable, Multipliable, SerializableVO Tax code with rate and description

State Management Value Objects

Value Object Interfaces Description
Status Stateful, Enumable, SerializableVO State machine with transition validation

Advanced Analysis Value Objects

Value Object Interfaces Description
VarianceResult Comparable, Addable, Subtractable, Multipliable, Divisible, Statistical, TrendAnalyzable, SerializableVO Budget variance with statistical and trend analysis

Metadata Value Objects

Value Object Interfaces Description
AttachmentMetadata SerializableVO File metadata for document attachments

Behavioral Interfaces (src/Contracts/)

Arithmetic Interfaces

Interface Methods Description
Addable add(self $other): static Addition capability
Subtractable subtract(self $other): static Subtraction capability
Multipliable multiply(float\|int $multiplier): static Multiplication by scalar
Divisible divide(float\|int $divisor): static Division by scalar

Comparison Interface

Interface Methods Description
Comparable compareTo(), equals(), greaterThan(), lessThan() Comparison capability

Conversion Interfaces

Interface Methods Description
Convertible convertTo(string $toUnit), canConvertTo(string $toUnit) Unit conversion capability
CurrencyConvertible convertToCurrency(), getCurrency() Currency conversion capability

Serialization Interfaces

Interface Methods Description
SerializableVO toArray(), toString(), fromArray() Serialization capability
Formattable format(array $options = []) Custom formatting capability

State/Enum Interfaces

Interface Methods Description
Enumable values(), getValue(), isValid() Enumeration capability
Stateful getState(), canTransitionTo(), isFinal() State machine capability

Time Interfaces

Interface Methods Description
Temporal getStartDate(), getEndDate(), contains(), overlaps() Temporal period capability
AdjustableTime shift(), extend() Time adjustment capability

Analysis Interfaces

Interface Methods Description
Auditable getCreatedBy(), getCreatedAt(), getUpdatedBy(), getUpdatedAt() Audit trail capability
Statistical average(), abs(), isWithinRange() Statistical analysis capability
TrendAnalyzable getTrendDirection(), percentageChange(), isSignificantChange() Trend analysis capability

System Interfaces

Interface Methods Description
ClockInterface now() Provides current time for testability
UlidInterface generate(), isValid(), getTimestamp() ULID generation for entity identifiers

Note: For event dispatching, use PSR-14's Psr\EventDispatcher\EventDispatcherInterface directly. This package depends on psr/event-dispatcher.

Exceptions (src/Exceptions/)

Exception Description
InvalidValueException Base exception for invalid value objects
InvalidMoneyException Exception for invalid Money operations
CurrencyMismatchException Exception when currencies don't match in operations

Usage Examples

Money Value Object

The Money value object provides immutable monetary value representation with precision arithmetic.

Important - Money vs Currency Package Boundary:

Use Money for calculations within a single currency. Use Nexus\Currency when you need exchange rates and cross-currency operations.

Percentage Value Object

Measurement and Quantity

Entity Identifiers

Contact Information

DateRange and Temporal Operations

Tax Calculation

Status State Machine

Variance Analysis (Advanced)

Audit Metadata

Attachment Metadata

TenantId

ClockInterface (System Interface)

Logging (PSR-3)

Design Principles

1. Immutability

All value objects are immutable (readonly classes). Operations return new instances:

2. Type Safety

Strong typing with PHP 8.3+ features:

3. Validation

Invalid states are impossible to create:

4. Interface Segregation Principle (ISP)

Small, focused interfaces that can be composed:

5. Framework Agnostic

No framework dependencies - works with any PHP framework:

6. Interface Composition Patterns

Arithmetic Group (Addable + Subtractable + Multipliable + Divisible):

Comparison + Serialization (Comparable + SerializableVO):

Temporal Group (Temporal + AdjustableTime):

State Management (Stateful + Enumable):

Analysis Group (Statistical + TrendAnalyzable):

Conversion Capabilities:

7. Behavior Contracts, Not Markers

Interfaces define actual capabilities with methods, not just markers:

Dependencies

All dependencies are minimal and framework-agnostic.

License

MIT License - see LICENSE file for details.


Part of the Nexus Package Monorepo


All versions of nexus-common with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-bcmath Version *
psr/event-dispatcher Version ^1.0
psr/log Version ^3.0
symfony/uid Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package azaharizaman/nexus-common contains the following files

Loading the files please wait ...