Discrete, dependable generated code repository

v0.2.0 2025-03-11 10:23 UTC

This package is auto-updated.

Last update: 2025-03-11 10:25:59 UTC


README

PHP from Packagist Latest Version Total Downloads GitHub Workflow Status PHPStan License

Discrete, dependable generated code repository

Iota provides a simple mechanism for storing, retrieving and loading generated code.

Get news and updates on the DecodeLabs blog.

Installation

Install via Composer:

composer require decodelabs/iota

Usage

Load a repository:

use DecodeLabs\Iota;

// Load manually
$repo = Iota::load('name', '/path/to/repo');

// Load an app-level repository only writable in dev mode
$repo = Iota::loadStatic('name');

// Load a writable app-level repository
$repo = Iota::loadDynamic('name');

Then you can store and retrieve code:

// Store anything
$repo->store(
    'key',
    <<<'PHP'
    <?php
    return 'Hello, world!';
    PHP
);

// Retrieve code
$code = $repo->fetch('key');

// Include quietly
$repo->include('key');

// Include and return
$value = $repo->Return('key'); // 'Hello, world!'

Licensing

Iota is licensed under the MIT License. See LICENSE for the full license text.