yaknet/dynlink

An enterprise-grade, high-performance PHP Dynamic Link Library (.ydl) engine for runtime modular linking, symbol resolution, digital signing, and in-memory execution.

Maintainers

Package info

github.com/y-packages/dynlink

pkg:composer/yaknet/dynlink

Transparency log

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.2 2026-08-20 02:05 UTC

This package is auto-updated.

Last update: 2026-08-20 02:08:10 UTC


README

PHP Version License: MIT Test Suite PHPStan

YakNet DynLink is an enterprise-grade, high-performance Dynamic Link Library (.ydl) and module runtime linker for PHP 8.2+. Inspired by C/C++ .dll and .so architectures, DynLink compiles PHP modules into single portable, compressed, and digitally-signed binary libraries that can be dynamically linked, loaded into memory, and executed at runtime without touching the physical filesystem.

🚀 Key Features & Performance Optimizations

  1. Single-Pass Fusion Bundler (__ydl_bundle.php):
    • Compiles multiple classes into a single-pass executable virtual bundle, reducing cold loading overhead to near-instant execution.
  2. Native PHP 8.2+ Attributes:
    • Modern #[YdlExport('Calculator')], #[YdlService('PaymentProcessor')], and #[YdlHook] attribute annotations.
  3. Security Sandbox & Capability System:
    • Inspects and validates dynamic library code against strict security policies, blocking dangerous functions (exec, system, shell_exec, eval).
  4. AES-256-GCM Payload Encryption:
    • Distribute proprietary, encrypted commercial modules with military-grade authenticated encryption.
  5. Built-in Nanosecond Profiler & Telemetry:
    • DynLink::profile() delivers fine-grained metrics for cold load, dynamic link, and memory consumption.
  6. Ed25519 & HMAC Cryptographic Signatures:
    • Tamper-proof module distribution with public-key verification.
  7. Virtual Memory Stream Wrapper (ydl://):
    • Zero filesystem footprint at runtime.

🛠️ Installation

composer require yaknet/dynlink

⚡ Usage Examples

1. Modern PHP 8.2+ Attribute Exports

namespace MyPlugin;

use YakNet\DynLink\Attributes\YdlExport;
use YakNet\DynLink\Attributes\YdlService;

#[YdlExport("Calculator")]
#[YdlService("Calculator")]
class Calculator
{
    public function sum(float ...$nums): float
    {
        return array_sum($nums);
    }
}

2. Packaging a Module

use YakNet\DynLink\DynLink;
use YakNet\DynLink\Security\Ed25519Signer;

DynLink::pack('./src/MyPlugin', './build/MyPlugin.ydl', [
    'compression' => 'gzip',
    'fusion' => true,
    'optimize' => true,
    'signer' => new Ed25519Signer(),
    'private_key' => $privateKey
]);

3. Loading & Invoking at Runtime

use YakNet\DynLink\DynLink;

$lib = DynLink::load('build/MyPlugin.ydl', [
    'verify_signature' => true,
    'public_key' => $publicKeyHex
]);

$calculator = $lib->getService('Calculator');
echo $calculator->sum(10, 20, 30); // 60

4. Performance Profiling

use YakNet\DynLink\DynLink;

$result = DynLink::profile('build/MyPlugin.ydl');
print_r($result['profile']->toArray());

🧪 Testing & Quality Assurance

# Run unit tests
composer test

# Run PHPStan static analysis (Level 9 - Maximum Strictness)
composer analyze

# Run benchmark suite
php example/benchmark.php

📄 License

This library is open-source software licensed under the MIT License. Copyright © 2026 YakNet Bilişim.