PHP code example of decodelabs / monarch

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


use DecodeLabs\Monarch;
$paths = Monarch::getPaths();

$paths->root = '/var/www/my-cool-app';
$paths->run = '/var/www/my-cool-app/dist';
$paths->localData = '/var/www/my-cool-app/data/local';
$paths->sharedData = '/var/www/my-cool-app/data/shared';

Monarch::setKingdom(new MyKingdom());

$paths->alias('@components', '@root/components');
$paths->alias('@assets', '@root/assets');

$path = $paths->resolve('@components/MyComponent.php');
// /var/www/my-cool-app/components/MyComponent.php

$service = Monarch::getService(MyService::class);