2017 © Pedro Peláez
 

library kernel

image

xervice/kernel

  • Monday, July 30, 2018
  • by mibexx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 262 Installations
  • PHP
  • 10 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Scrutinizer Code Quality Code Coverage, (*1)

Kernel for application extending via services., (*2)

Installation

composer require xervice/kernel

Configuration

You can add your services to the kernel with extending the dependency provider in your application., (*3)

<?php

namespace App\Kernel;

use Xervice\Kernel\KernelDependencyProvider as XerviceKernelDependencyProvider;

class KernelDependencyProvider extends XerviceKernelDependencyProvider
{
    /**
     * Service classes with key as service name
     * e.g.
     * myService => myservice::class
     *
     * @return array
     */
    protected function getServiceList(): array
    {
        return [
            'routing' => MyRoutingService::class
        ];
    }
}

Usage

You can use the kernel to initiate a application and run all dependend boot procedures., (*4)

use Xervice\Core\Locator\Locator;


$locator = Locator::getInstance();
$kernel = $locator->kernel()->facade();

try {
    $kernel->boot();
    $kernel->run();
} catch (\Exception $e) {
    $locator->exceptionHandler()->facade()->handleException($e);
}

Own services

To create an own service you have to implement the BootInterface and/or the ExecuteInterface., (*5)

Example, (*6)

<?php

namespace App\MyModule\Business\Kernel;

use Xervice\Kernel\Business\Model\Service\ServiceProviderInterface;
use Xervice\Kernel\Business\Plugin\BootInterface;
use Xervice\Kernel\Business\Plugin\ExecuteInterface;

class MyService implements BootInterface, ExecuteInterface
{
    /**
     * @param \Xervice\Kernel\Business\Model\Service\ServiceProviderInterface $serviceProvider
     */
    public function boot(ServiceProviderInterface $serviceProvider): void
    {
        // boot something
    }

    /**
     * @param \Xervice\Kernel\Business\Model\Service\ServiceProviderInterface $serviceProvider
     */
    public function execute(ServiceProviderInterface $serviceProvider): void
    {
        // execute something
    }

}

The Versions

30/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

30/07 2018

1.3.1

1.3.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

25/07 2018

1.3.0

1.3.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

25/07 2018

1.2.0

1.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

23/07 2018

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram

22/07 2018

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Bertram