LENKRAD - The modern PHP core


Unifying common setup necessities

The Setup class

Starting from version v0.2, the app requires an instance of the setup-helper. This simplifies the setup process greatly.

Main methods


set(string $key, mixed $value)

Registers a value available throughout the app

get(string $key)

Retrieves a value


Retrieves an array of all setup values

setPublicPath(string $path)

Registers web-path

setLibraryPath(string $path)

Registers source-path

setDatabaseAdapter(Adapter $adapter)

Accepts instantiated Database adapter

setSkeletonVariables(array $skeletonVariables)

See templating (variables)

setSkeletonComponentPlacement(string $skeletonComponentPlacement)

See templating (placement)

setSkeletonHTML(string $skeletonHTML)

See templating (skeleton)

setUseSkeleton(bool $useSkeleton)

Set true for use of layout/frame mode

setDefault404(string $default404)

Set own 404 page html

setDefault500(string $default500)

Set own system error page html

setTemplatePath(string $templatePath)

Set relative base path for templating

Example with custom value



            // /public/index.php

            use Neoan\NeoanApp;
            use Neoan\Routing\Route;
            use Neoan\Helper\Setup;

            $projectPath = dirname(__DIR__);
            require_once $projectPath . '/vendor/autoload.php';

            $pathToSourceFiles = $projectPath . '/src';
            $publicPath = __DIR__;

            $setup = new Setup();
                  // some arbitrary setup value
                  ->set('globalArray', ['a']);

            $app = new NeoanApp($setup);


            // run application

Some controller

            namespace App;

            use Neoan\Routing\Interfaces\Routable;
            use Neoan\Helper\Setup;

            class Controller implements Routable
                // auto-wire our setup instance
                public function __invoke(Setup $setup): array
                    // let's return our globalArray
                    return $setup->get('globalArray');

Before you move on

Many references on this page assume default settings. Your project might differ in behavior, paths etc.