1. Go to this page and download the library: Download decodelabs/kingdom 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 / kingdom example snippets
use DecodeLabs\Kingdom\Service;
use DecodeLabs\Kingdom\ServiceTrait;
class MyService implements Service
{
use ServiceTrait;
}
$service = $myKingdom->getService(MyService::class);
use DecodeLabs\Monarch;
$service = Monarch::getService(MyService::class);
use DecodeLabs\Monarch;
Monarch::setKingdom($myKingdom);
$myKingdom->run();
namespace My\Namespace;
use DecodeLabs\Fabric\Kingdom as FabricKingdom;
use DecodeLabs\Harvest\Profile as HttpProfile;
use DecodeLabs\Harvest\Middleware\Cors;
class Kingdom extends FabricKingdom
{
public protected(set) string $name = 'DecodeLabs Playground';
public function initialize(): void
{
parent::initialize();
Monarch::getPaths()->alias('@public', '@run/public');
Monarch::getPaths()->alias('@components', '@run/src/@components');
$this->container->prepare(
HttpProfile::class,
fn (HttpProfile $profile) => $profile->add(Cors::class, allow: ['*'])
);
$this->container->setFactory(
SomeOtherThing::class,
fn () => new SomeOtherThing()
);
// ...etc
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.