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 function getApplicationPath(): string;
    public function getLocalDataPath(): string;
    public function getSharedDataPath(): string;
    public function getApplicationName(): string;
    public function initializeLoaders(StackLoader $loader): void;
    public function loadBuild(): Build;
    public function loadEnvironmentConfig(): EnvConfig;
    public function initializePlatform(): void;
    public function loadKernel(): Kernel;
    public function getBuildManifest(): ?BuildManifest;
}

$appPath = Genesis::$hub->getApplicationPath();

interface Kernel
{
    public function initialize(): void;
    public function getMode(): string;

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

$runMode = Genesis::$kernel->getMode();

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

$envName = Genesis::$environment->getName();
$rootPath = Genesis::$build->getPath();

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

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

// Composer autoload
sis;
use My\Hub;

Genesis::run(Hub::class, [
    // any options your custom hub needs
]);