PHPackages                             azaharizaman/nexus-fixed-asset-depreciation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. azaharizaman/nexus-fixed-asset-depreciation

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

azaharizaman/nexus-fixed-asset-depreciation
===========================================

Framework-agnostic fixed asset depreciation calculation engine with progressive delivery (SB→MB→LE)

v0.1.0-alpha1(2mo ago)00MITPHP ^8.3

Since May 5Compare

[ Source](https://github.com/azaharizaman/nexus-fixed-asset-depreciation)[ Packagist](https://packagist.org/packages/azaharizaman/nexus-fixed-asset-depreciation)[ RSS](/packages/azaharizaman-nexus-fixed-asset-depreciation/feed)WikiDiscussions Synced 3w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Nexus\\FixedAssetDepreciation
=============================

[](#nexusfixedassetdepreciation)

Enterprise-grade fixed asset depreciation calculation engine with Progressive Delivery for Small Business to Large Enterprise.

Overview
--------

[](#overview)

The **Nexus\\FixedAssetDepreciation** package provides a comprehensive depreciation calculation engine for fixed assets within the Nexus ERP system. It serves as the **specialized depreciation layer** that enables organizations to calculate, track, and manage asset depreciation using multiple methodologies compliant with both GAAP and IFRS accounting standards.

This package extends beyond basic depreciation offered in the [Nexus\\Assets](../Assets/README.md) package by providing:

- Advanced calculation methods beyond basic straight-line
- Comprehensive schedule management with forecasting
- Tax vs Book parallel depreciation
- IFRS-compliant revaluation model
- Automated GL journal entry integration

Key Features
------------

[](#key-features)

### 🎯 Core Capabilities

[](#-core-capabilities)

- **Multiple Depreciation Methods**: Straight-Line, Double Declining, Sum-of-Years-Digits, Units of Production, Annuity, MACRS
- **Depreciation Scheduling**: Automated schedule generation, adjustment, and forecasting
- **Asset Revaluation**: IFRS IAS 16 compliant revaluation with equity adjustments
- **Tax-Book Reconciliation**: Parallel calculation for tax reporting and book purposes
- **GL Integration**: Automated journal entry posting for depreciation expense
- **Impairment Support**: Partial asset impairment calculations

### 🔄 Depreciation Methods

[](#-depreciation-methods)

MethodTierDescription**Straight-Line**1Equal depreciation over useful life**Straight-Line Daily**1Daily prorating for mid-month acquisitions (GAAP-compliant)**Double Declining Balance**2200% of straight-line rate (accelerated)**150% Declining Balance**2150% of straight-line rate**Sum-of-Years-Digits**2Accelerated based on sum of years digits**Units of Production**3Usage-based depreciation**Annuity Method**3Interest-based calculation**MACRS**3US tax depreciation (IRS tables)**Bonus Depreciation**3First-year bonus deduction### 🔐 Financial Controls

[](#-financial-controls)

- **Tenant Isolation**: Multi-tenant data security with per-tenant depreciation configurations
- **Period-Based Depreciation**: Fiscal period validation and depreciation tracking
- **GL Account Mapping**: Integration with chart of accounts for expense and accumulated depreciation
- **Audit Trail**: Comprehensive logging via Nexus\\Audit
- **Approval Workflows**: Optional approval for revaluations (Tier 3)

Progressive Feature Tiers
-------------------------

[](#progressive-feature-tiers)

TierTargetKey Features**Tier 1: Basic**Small Business (SB)Straight-Line (basic + daily), Simple schedules, Manual GL posting**Tier 2: Advanced**Medium Business (MB)DDB, 150% DB, SYD, Schedule adjustments, Forecasting, Basic revaluation**Tier 3: Enterprise**Large Enterprise (LE)UOP, Annuity, MACRS, Tax-Book parallel, Full IFRS revaluation, Auto GL postingArchitecture
------------

[](#architecture)

### Framework Agnosticism

[](#framework-agnosticism)

This package contains **pure PHP logic** and is completely framework-agnostic:

- ✅ No Laravel dependencies in `/src`
- ✅ All dependencies via contracts (interfaces)
- ✅ Readonly constructor property promotion
- ✅ Native PHP 8.3 enums with business logic
- ✅ Immutable value objects
- ✅ PSR-3 logging, PSR-14 event dispatching

### Directory Structure

[](#directory-structure)

```
src/
├── Contracts/
│   ├── DepreciationManagerInterface.php          # Primary facade
│   ├── DepreciationCalculatorInterface.php       # Calculation engine
│   ├── DepreciationScheduleManagerInterface.php  # Schedule management
│   ├── AssetRevaluationInterface.php             # Revaluation operations
│   ├── DepreciationMethodInterface.php            # Method abstraction
│   ├── DepreciationQueryInterface.php             # CQRS: Read operations
│   ├── DepreciationPersistInterface.php           # CQRS: Write operations
│   └── Integration/                               # External package integrations
├── Entities/
│   ├── AssetDepreciation.php                     # Depreciation entity
│   ├── DepreciationSchedule.php                  # Schedule entity
│   ├── DepreciationMethod.php                    # Method entity
│   ├── AssetRevaluation.php                      # Revaluation entity
│   └── DepreciationAdjustment.php                # Adjustment entity
├── Enums/
│   ├── DepreciationMethodType.php                 # SL, DDB, SYD, UOP, Annuity
│   ├── DepreciationStatus.php                    # Calculated, Posted, Reversed
│   ├── RevaluationType.php                       # Increment, Decrement
│   ├── DepreciationType.php                       # Book, Tax
│   └── ProrateConvention.php                      # Full month, Daily, None
├── ValueObjects/
│   ├── DepreciationAmount.php                    # Immutable depreciation amount
│   ├── DepreciationSchedulePeriod.php            # Single period schedule
│   ├── DepreciationForecast.php                  # Future depreciation
│   ├── BookValue.php                             # Current book value
│   ├── RevaluationAmount.php                     # Revaluation delta
│   └── DepreciationLife.php                     # Useful life and salvage
├── Services/
│   ├── DepreciationManager.php                    # Main orchestrator
│   ├── DepreciationCalculator.php                # Calculation engine
│   ├── DepreciationScheduleGenerator.php         # Schedule generation
│   ├── AssetRevaluationService.php               # Revaluation logic
│   ├── DepreciationMethodFactory.php             # Method instantiation
│   └── TaxBookDepreciationEngine.php             # Tax vs Book parallel
├── Exceptions/
│   ├── DepreciationException.php                 # Base exception
│   ├── DepreciationCalculationException.php      # Calculation error
│   ├── InvalidDepreciationMethodException.php    # Invalid method
│   ├── AssetNotDepreciableException.php          # Non-depreciable asset
│   ├── DepreciationPeriodClosedException.php    # Period closed
│   ├── RevaluationException.php                 # Revaluation error
│   └── ScheduleNotFoundException.php            # Schedule not found
└── Events/
    ├── DepreciationCalculatedEvent.php           # Calculation complete
    ├── DepreciationPostedEvent.php               # JE posted
    ├── DepreciationReversedEvent.php            # Reversal complete
    ├── AssetRevaluedEvent.php                    # Revaluation complete
    └── DepreciationScheduleAdjustedEvent.php    # Schedule modified

```

### Integration Points

[](#integration-points)

PackageIntegration Purpose**Nexus\\Assets**Asset data, acquisition info, book values**Nexus\\ChartOfAccount**Depreciation expense and accumulated depreciation GL accounts**Nexus\\JournalEntry**Automatic JE posting for depreciation**Nexus\\Period**Fiscal period validation**Nexus\\Tenant**Multi-entity isolation**Nexus\\Tax**Tax depreciation calculations (MACRS, bonus) - Optional**Nexus\\Currency**Multi-currency asset depreciation - OptionalInstallation
------------

[](#installation)

### 1. Add to Root Composer

[](#1-add-to-root-composer)

```
{
    "repositories": [
        {
            "type": "path",
            "url": "./packages/FixedAssetDepreciation"
        }
    ]
}
```

### 2. Install Package

[](#2-install-package)

```
composer require azaharizaman/nexus-fixed-asset-depreciation:"*@dev"
```

### 3. Register Service Provider (Laravel)

[](#3-register-service-provider-laravel)

In `apps/Atomy/config/app.php`:

```
'providers' => [
    // ...
    App\Providers\FixedAssetDepreciationServiceProvider::class,
],
```

### 4. Configure Tier

[](#4-configure-tier)

Set the tier for your tenant in application settings:

```
use Nexus\Setting\SettingManager;

$settings->setString('fixed_asset_depreciation.tier', 'basic'); // or 'advanced', 'enterprise'
```

Quick Start
-----------

[](#quick-start)

### Tier 1: Basic Depreciation

[](#tier-1-basic-depreciation)

```
use Nexus\FixedAssetDepreciation\Contracts\DepreciationManagerInterface;
use Nexus\FixedAssetDepreciation\Enums\DepreciationMethodType;
use Nexus\FixedAssetDepreciation\Enums\DepreciationType;

$manager = app(DepreciationManagerInterface::class);

// Calculate depreciation for a single asset in a period
$depreciation = $manager->calculateDepreciation(
    assetId: '01ASSET-A001',
    periodId: '01PERIOD-2026-01'
);

echo "Depreciation Amount: " . $depreciation->getDepreciationAmount()->getAmount();
echo "Book Value After: " . $depreciation->getBookValueAfter()->getNetBookValue();
```

### Generate Depreciation Schedule

[](#generate-depreciation-schedule)

```
// Generate full depreciation schedule for an asset
$schedule = $manager->generateSchedule(assetId: '01ASSET-A001');

foreach ($schedule->getPeriods() as $period) {
    echo "Period: " . $period->getPeriodId();
    echo "Depreciation: " . $period->getDepreciationAmount();
    echo "Book Value: " . $period->getNetBookValue();
}
```

### Run Periodic Depreciation (Monthly)

[](#run-periodic-depreciation-monthly)

```
// Process all assets for period-end depreciation
$result = $manager->runPeriodicDepreciation(
    periodId: '01PERIOD-2026-01'
);

echo "Processed: " . $result->getProcessedCount() . " assets";
echo "Total Depreciation: " . $result->getTotalDepreciation();
```

### Reverse Depreciation

[](#reverse-depreciation)

```
// Reverse a depreciation calculation (e.g., due to error)
$manager->reverseDepreciation(
    depreciationId: '01DEP-2026-01-001',
    reason: 'Incorrect useful life used'
);
```

### Asset Revaluation (Tier 2+)

[](#asset-revaluation-tier-2)

```
use Nexus\FixedAssetDepreciation\Enums\RevaluationType;

// Revalue an asset (IFRS IAS 16 compliant)
$revaluation = $manager->revalueAsset(
    assetId: '01ASSET-A001',
    newValue: 15000.00,
    newSalvageValue: 1500.00,
    revaluationType: RevaluationType::INCREMENT,
    reason: 'Market value increase',
    glAccountId: '01GL-REVALUATION'
);

echo "Revaluation Amount: " . $revaluation->getRevaluationAmount()->getAmount();
echo "New Book Value: " . $revaluation->getNewBookValue()->getNetBookValue();
```

### Tax Depreciation (Tier 3)

[](#tax-depreciation-tier-3)

```
// Calculate tax depreciation (MACRS) parallel to book depreciation
$taxDepreciation = $manager->calculateTaxDepreciation(
    assetId: '01ASSET-A001',
    taxMethod: 'MACRS',
    taxYear: 2026
);

echo "Tax Depreciation: " . $taxDepreciation->getAmount();
echo "Book Depreciation: " . $bookDepreciation->getAmount();
echo "Tax vs Book Difference: " . $taxDepreciation->subtract($bookDepreciation);
```

### Depreciation Forecast

[](#depreciation-forecast)

```
// Forecast future depreciation
$forecast = $manager->forecastDepreciation(
    assetId: '01ASSET-A001',
    periods: 12 // Next 12 months
);

foreach ($forecast->getPeriodForecasts() as $period) {
    echo $period->getPeriodId() . ": " . $period->getForecastedAmount();
}
```

Key Interfaces
--------------

[](#key-interfaces)

### DepreciationManagerInterface

[](#depreciationmanagerinterface)

Primary facade providing access to all depreciation operations:

```
calculateDepreciation(string $assetId, string $periodId): AssetDepreciation
generateSchedule(string $assetId): DepreciationSchedule
runPeriodicDepreciation(string $periodId): DepreciationRunResult
reverseDepreciation(string $depreciationId, string $reason): void
revalueAsset(string $assetId, float $newValue, RevaluationType $type): AssetRevaluation
calculateTaxDepreciation(string $assetId, string $taxMethod, int $taxYear): DepreciationAmount
forecastDepreciation(string $assetId, int $periods): DepreciationForecast
```

### DepreciationCalculatorInterface

[](#depreciationcalculatorinterface)

Core calculation engine:

```
calculate(string $assetId, ?DateTimeInterface $asOfDate, ?DepreciationType $type): DepreciationAmount
calculateForPeriod(string $assetId, string $periodId, ?DepreciationType $type): AssetDepreciation
forecast(string $assetId, int $numberOfPeriods): DepreciationForecast
```

### DepreciationScheduleManagerInterface

[](#depreciationschedulemanagerinterface)

Schedule management:

```
generate(string $assetId): DepreciationSchedule
adjust(string $scheduleId, array $adjustments): DepreciationSchedule
close(string $assetId): void
recalculate(string $assetId): DepreciationSchedule
```

### AssetRevaluationInterface

[](#assetrevaluationinterface)

Revaluation operations:

```
revalue(string $assetId, float $newCost, RevaluationType $type): AssetRevaluation
reverse(string $revaluationId): AssetRevaluation
getRevaluationHistory(string $assetId): array
```

Domain Model
------------

[](#domain-model)

### Entities

[](#entities)

EntityDescription[`AssetDepreciation`](src/Entities/AssetDepreciation.php)Single depreciation calculation per period[`DepreciationSchedule`](src/Entities/DepreciationSchedule.php)Full schedule from acquisition to disposal[`DepreciationMethod`](src/Entities/DepreciationMethod.php)Depreciation method configuration[`AssetRevaluation`](src/Entities/AssetRevaluation.php)Asset revaluation event[`DepreciationAdjustment`](src/Entities/DepreciationAdjustment.php)Schedule adjustment record### Value Objects

[](#value-objects)

Value ObjectPurpose[`DepreciationAmount`](src/ValueObjects/DepreciationAmount.php)Immutable monetary amount with arithmetic[`BookValue`](src/ValueObjects/BookValue.php)Current book value with depreciation tracking[`DepreciationLife`](src/ValueObjects/DepreciationLife.php)Useful life and salvage value[`DepreciationForecast`](src/ValueObjects/DepreciationForecast.php)Future depreciation projections[`DepreciationSchedulePeriod`](src/ValueObjects/DepreciationSchedulePeriod.php)Single period in schedule[`RevaluationAmount`](src/ValueObjects/RevaluationAmount.php)Revaluation delta with breakdown### Enums

[](#enums)

EnumValues[`DepreciationMethodType`](src/Enums/DepreciationMethodType.php)STRAIGHT\_LINE, DOUBLE\_DECLINING, SUM\_OF\_YEARS, UNITS\_OF\_PRODUCTION, ANNUITY, MACRS, BONUS[`DepreciationType`](src/Enums/DepreciationType.php)BOOK, TAX[`DepreciationStatus`](src/Enums/DepreciationStatus.php)CALCULATED, POSTED, REVERSED, ADJUSTED[`RevaluationType`](src/Enums/RevaluationType.php)INCREMENT, DECREMENT[`ProrateConvention`](src/Enums/ProrateConvention.php)FULL\_MONTH, DAILY, NONEExceptions
----------

[](#exceptions)

ExceptionDescription[`DepreciationException`](src/Exceptions/DepreciationException.php)Base exception[`DepreciationCalculationException`](src/Exceptions/DepreciationCalculationException.php)Calculation error[`InvalidDepreciationMethodException`](src/Exceptions/InvalidDepreciationMethodException.php)Invalid method for asset[`AssetNotDepreciableException`](src/Exceptions/AssetNotDepreciableException.php)Asset not eligible for depreciation[`DepreciationPeriodClosedException`](src/Exceptions/DepreciationPeriodClosedException.php)Period already closed[`RevaluationException`](src/Exceptions/RevaluationException.php)Revaluation error[`ScheduleNotFoundException`](src/Exceptions/ScheduleNotFoundException.php)Schedule not found[`DepreciationOverrideException`](src/Exceptions/DepreciationOverrideException.php)Override conflictDepreciation Formulas
---------------------

[](#depreciation-formulas)

### Straight-Line (Tier 1)

[](#straight-line-tier-1)

```
Annual Depreciation = (Cost - Salvage) / Useful Life

```

Daily prorating for mid-month acquisitions:

```
Monthly = Annual / 12
Daily Proration = Monthly × (Days Owned / Days in Month)

```

### Double Declining Balance (Tier 2)

[](#double-declining-balance-tier-2)

```
Rate = 2 / Useful Life (years)
Year N Depreciation = Book Value at Start of Year × Rate
(Cannot depreciate below salvage value)

```

### Sum-of-Years-Digits (Tier 2)

[](#sum-of-years-digits-tier-2)

```
Sum = n(n+1)/2 where n = useful life
Year N Depreciation = (Cost - Salvage) × (Remaining Life / Sum)

```

### Units of Production (Tier 3)

[](#units-of-production-tier-3)

```
Depreciation = (Cost - Salvage) × (Units Produced / Total Expected Units)

```

Configuration
-------------

[](#configuration)

### Settings (via Nexus\\Setting)

[](#settings-via-nexussetting)

```
'fixed_asset_depreciation.tier' => 'basic',  // basic|advanced|enterprise
'fixed_asset_depreciation.default_method' => 'STRAIGHT_LINE',
'fixed_asset_depreciation.prorate_convention' => 'daily',  // daily|full_month|none
'fixed_asset_depreciation.auto_gl_post' => false,  // Tier 3
'fixed_asset_depreciation.enable_tax_depreciation' => false,  // Tier 3
'fixed_asset_depreciation.max_forecast_periods' => 60,
```

### GL Account Mapping

[](#gl-account-mapping)

```
// Default GL accounts (can be overridden per asset category)
'fixed_asset_depreciation.gl_defaults' => [
    'depreciation_expense' => '6000-DEPR-EXP',
    'accumulated_depreciation' => '1600-ACCUM-DEPR',
    'gains_on_disposal' => '7000-GAIN-DISP',
    'losses_on_disposal' => '8000-LOSS-DISP',
    'revaluation_reserve' => '2500-REVAL-RES',
],
```

Event Catalog
-------------

[](#event-catalog)

### Published Events

[](#published-events)

- `DepreciationCalculatedEvent` - Single depreciation calculation complete
- `DepreciationPostedEvent` - Journal entry posted to GL
- `DepreciationReversedEvent` - Depreciation reversed
- `AssetRevaluedEvent` - Asset revaluation complete
- `DepreciationScheduleAdjustedEvent` - Schedule modified
- `DepreciationRunCompletedEvent` - Batch depreciation run complete

### Subscribed Events

[](#subscribed-events)

- `Nexus\Assets\Events\AssetAcquiredEvent` - Generate initial depreciation schedule
- `Nexus\Assets\Events\AssetDisposedEvent` - Close depreciation schedule
- `Nexus\Period\Events\PeriodClosedEvent` - Process period-end depreciation

Requirements
------------

[](#requirements)

This package implements comprehensive requirements covering:

- **Architectural Requirements**: Framework-agnostic, interfaces, immutability
- **Business Requirements**: Depreciation methods, schedules, revaluation
- **Functional Requirements**: CRUD, calculations, reporting
- **Integration Requirements**: External package interfaces
- **Security Requirements**: Tenant isolation, authorization
- **Performance Requirements**: Batch processing, forecasting

For detailed requirements, see [REQUIREMENTS.md](REQUIREMENTS.md).

Architecture (see ARCHITECTURE.md)
----------------------------------

[](#architecture-see-architecturemd)

For detailed architecture documentation, see [ARCHITECTURE.md](ARCHITECTURE.md) which covers:

- Package overview and scope
- Architecture principles (framework-agnostic, DI, CQRS, immutability)
- Directory structure
- Entity relationships
- Service orchestration
- Integration patterns
- Progressive delivery tiers

Development
-----------

[](#development)

### Testing

[](#testing)

```
# Package tests (framework-agnostic)
vendor/bin/phpunit packages/FixedAssetDepreciation/tests

# Atomy integration tests
php artisan test --filter FixedAssetDepreciation
```

### Code Style

[](#code-style)

This package follows strict coding standards:

- PHP 8.3+ with strict typing
- `declare(strict_types=1)` in all files
- Readonly properties for immutability
- Constructor property promotion
- PSR-12 coding standards
- Comprehensive docblocks

Documentation
-------------

[](#documentation)

### Package Documentation

[](#package-documentation)

- **[Architecture](ARCHITECTURE.md)** - Detailed architecture documentation
- **[Requirements](REQUIREMENTS.md)** - Complete requirements traceability
- **[Getting Started Guide](docs/getting-started.md)** - Quick start guide
- **[API Reference](docs/api-reference.md)** - Complete API documentation

### Additional Resources

[](#additional-resources)

- `docs/examples/` - Usage examples
- See root `ARCHITECTURE.md` for overall system architecture
- See `plans/FINANCE_ECOSYSTEM_EXECUTION_PLAN.md` for finance ecosystem context

License
-------

[](#license)

MIT License - See [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

For questions or issues, please refer to the main Nexus documentation or contact the development team.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance84

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

81d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/117408?v=4)[Azahari Zaman](/maintainers/azaharizaman)[@azaharizaman](https://github.com/azaharizaman)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/azaharizaman-nexus-fixed-asset-depreciation/health.svg)

```
[![Health](https://phpackages.com/badges/azaharizaman-nexus-fixed-asset-depreciation/health.svg)](https://phpackages.com/packages/azaharizaman-nexus-fixed-asset-depreciation)
```

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

515139.2M711](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k54](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k46](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M221](/packages/illuminate-broadcasting)[logiscape/mcp-sdk-php

Model Context Protocol SDK for PHP

367116.8k12](/packages/logiscape-mcp-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
