PHP code example of coretsia / core-kernel

1. Go to this page and download the library: Download coretsia/core-kernel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

coretsia / core-kernel example snippets


new ArtifactRuntimeInput(
    skeletonRoot: $skeletonRoot,
    artifactRoot: $artifactRoot,
);

public function boot(
    ArtifactRuntimeInput $input,
): ContainerInterface;

public function buildFromEnvelope(
    array $containerEnvelope,
    RuntimeContainerSeedSet $seeds,
): Container;

RuntimeDriverContributions::fromDrivers(
    httpDrivers: [],
    backgroundDrivers: [],
)

return [
    'config' => [
        'forbidden_top_level_roots' => [
            'coretsia',
            '_internal',
        ],
    ],
    'boot' => [
        'default_env' => 'local',
        'default_preset' => 'micro',
        'default_debug' => false,
        'default_artifacts_cache_dir' => 'var/cache',
    ],
    'runtime' => [
        'frankenphp' => [
            'enabled' => false,
        ],
        'swoole' => [
            'enabled' => false,
        ],
        'roadrunner' => [
            'enabled' => false,
        ],
    ],
    'env' => [
        'source_policy' => [
            'default_local' => 'strict_dotenv',
            'default_production' => 'allow_system',
        ],
        'dotenv' => [
            'files' => [
                '.env',
                '.env.local',
                '.env.<env>',
                '.env.<env>.local',
            ],
        ],
    ],
    'modules' => [
        'discovery' => [
            'source' => 'composer',
            'allowed_sources' => [
                'composer',
            ],
        ],
    ],
    'modes' => [
        'schema_version' => 1,
        'defaults_path' => 'resources/modes',
        'overrides_path' => 'config/modes',
    ],
    'fingerprint' => [
        'skeleton_ignore_prefixes' => [
            'var/maintenance',
        ],
    ],
    'uow' => [
        'attributes' => [
            'max_depth' => 10,
            'max_keys' => 200,
        ],
    ],
];

return [
    'kernel' => [
        'uow' => [
            'attributes' => [],
        ],
    ],
];

return [
    'artifactsCacheDir' => 'var/artifacts_cache',
];
text
skeleton/config/app.php
text
skeleton/config/roots.php
skeleton/config/<root>.php
skeleton/config/environments/**
skeleton/apps/<appTarget>/config/**
text
BootstrapInput::artifactsCacheDir()
→ skeleton/config/app.php artifactsCacheDir
→ kernel.boot.default_artifacts_cache_dir
→ BootstrapConfig::artifactsCacheDir()
text
$_ENV
$_SERVER
getenv()
skeleton/config/app.php
text
roots.php
<root>.php
text
user_owned
unvalidated
text
<artifact-root>/
  current
  generation.lock
  generations/
    <generation-id>/
      module-manifest.php
      config.php
      container.php
      generation-manifest.php
text
docs/ssot/artifacts.md
text
docs/ssot/artifact-generations.md
text
docs/ssot/compiled-container.md
text
one ConfigKernel::compile(...)
→ assert the returned ConfigValidationResult
→ canonical provider graph
→ graph-bound fingerprint
→ module-manifest@1
→ config@1
→ container@1
→ ArtifactPublicationSet
→ ArtifactGenerationPublisher
→ staging generation directory
→ write module-manifest.php, config.php, and container.php
→ build and write generation-manifest.php as artifact-generation@1
→ validate staging generation
→ finalize or reuse immutable generation
→ atomic current switch
→ returned ArtifactGeneration
→ safe four-file published-generation summary
text
schemaVersion = 1
generationId = lowercase SHA-256
module-manifest@1 → module-manifest.php
config@1 → config.php
container@1 → container.php
artifact-generation@1 → generation-manifest.php
text
1. skeleton override: skeleton/config/modes/<preset>.php
2. framework default: resources/modes/<preset>.php
text
CORETSIA_MODULE_OPTIONAL_MISSING
text
CORETSIA_RUNTIME_DRIVER_MATRIX_CONFLICT
CORETSIA_RUNTIME_DRIVER_MATRIX_INVALID_CONFIG
text
docs/ssot/runtime-drivers.md
text
beginUnitOfWork(string $type, array $attributes = []): UnitOfWorkHandle
afterUnitOfWork(UnitOfWorkHandle $handle, string $outcome, ?Throwable $error = null, array $extensions = []): array
text
framework/packages/core/kernel/config/kernel.php