PHP code example of decodelabs / genesis

1. Go to this page and download the library: Download decodelabs/genesis 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/ */

    

decodelabs / genesis example snippets


namespace DecodeLabs\Genesis;

use DecodeLabs\Genesis\Loader\Stack as StackLoader;
use DecodeLabs\Genesis\Environment\Config as EnvConfig;
use DecodeLabs\Genesis\Build\Manifest as BuildManifest;

interface Hub
{
    public ?BuildManifest $buildManifest { get; }

    public function initializeLoaders(StackLoader $loader): void;
    public function loadBuild(): Build;
    public function loadEnvironmentConfig(): EnvConfig;
    public function initializePlatform(): void;
    public function loadKernel(): Kernel;
}

$buildManifest = Genesis::$hub->buildManifest;

interface Kernel
{
    public string $mode { get; }

    public function initialize(): void;
    public function run(): void;
    public function shutdown(): never;
}

$runMode = Genesis::$kernel->mode;

if(Genesis::$environment->isDevelopment()) {
    // Do fun dev stuff
}

$envName = Genesis::$environment->name;
$rootPath = Genesis::$build->path;

if(Genesis::$build->isCompiled()) {
    // We've compiled a build
}

// Get time of build to use in URLs as a cache buster
$cacheBuster = Genesis::$build->cacheBuster;

// Load Bootstrap strategy
otstrap\Seamless;
use My\Hub;

new Seamless(
    hubClass: Hub::class
)->run();