Skip to content

Commit

Permalink
Merge pull request #5 from Micro-PHP/release-1.3
Browse files Browse the repository at this point in the history
v1.3 release
  • Loading branch information
Asisyas authored Dec 28, 2022
2 parents 44049f8 + 0c19c5d commit 7ebce72
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "micro/kernel-app",
"description": "Micro Framework: App Kernel component",
"type": "library",
"version": "1.2",
"version": "1.3",
"license": "MIT",
"autoload": {
"psr-4": {
Expand All @@ -20,6 +20,7 @@
"micro/deprecation-supports": "^1",
"micro/plugin-event-emitter": "^1",
"micro/kernel-boot-dependency": "^1",
"micro/kernel-boot-configuration": "^1"
"micro/kernel-boot-configuration": "^1",
"micro/kernel-boot-plugin-depended": "^1"
}
}
12 changes: 11 additions & 1 deletion src/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Micro\Component\DependencyInjection\Container;
use Micro\Framework\Kernel\Boot\ConfigurationProviderBootLoader;
use Micro\Framework\Kernel\Boot\DependedPluginsBootLoader;
use Micro\Framework\Kernel\Boot\DependencyProviderBootLoader;
use Micro\Framework\Kernel\Configuration\ApplicationConfigurationInterface;
use Micro\Framework\Kernel\Container\ApplicationContainerFactoryInterface;
Expand Down Expand Up @@ -113,6 +114,14 @@ public function addBootLoader(PluginBootLoaderInterface $pluginBootLoader): self
return $this;
}

/**
* {@inheritDoc}
*/
public function loadPlugin(string $applicationPluginClass): void
{
$this->kernel->loadPlugin($applicationPluginClass);
}

/**
* @return KernelInterface
*/
Expand Down Expand Up @@ -148,7 +157,7 @@ protected function createKernelBuilder(): KernelBuilder
*/
protected function createInitActionProcessor(): KernelActionProcessorInterface
{
return new KernelRunActionProcessor($this->container());
return new KernelRunActionProcessor();
}

/**
Expand All @@ -170,6 +179,7 @@ protected function createBootLoaderCollection(): array
return [
new DependencyProviderBootLoader($this->container),
new ConfigurationProviderBootLoader($this->configuration),
new DependedPluginsBootLoader($this),
...$bl
];
}
Expand Down
53 changes: 53 additions & 0 deletions src/AppKernelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,59 @@
use Micro\Framework\Kernel\KernelInterface;
use Micro\Framework\Kernel\Plugin\PluginBootLoaderInterface;

/**
* Used to decorate the `micro/kernel` and simplify its creation.
* By default, plugin configuration initialization and dependency provider initialization loaders have been added.
*
* **Installation**
* ```bash
* $ composer require micro/kernel-app
* ```
*
* **Basic example**
* ```php
* $applicationConfiguration = new class extends DefaultApplicationConfiguration {
*
* private readonly Dotenv $dotenv;
*
* public function __construct()
* {
* $basePath = dirname(__FILE__) . '/../';
* $_ENV['BASE_PATH'] = $basePath;
* $env = getenv('APP_ENV') ?: 'dev';
*
* $envFileCompiled = $basePath . '/' . '.env.' .$env . '.php';
* if(file_exists($envFileCompiled)) {
* $content = include $envFileCompiled;
* parent::__construct($content);
*
* return;
* }
*
* $names[] = '.env';
* $names[] = '.env.' . $env;
* // Dotenv library is not included by default. Used for example.
* $this->dotenv = Dotenv::createMutable($basePath, $names, false);
* $this->dotenv->load();
*
* parent::__construct($_ENV);
* }
* };
*
* $kernel = new AppKernel(
* $applicationConfiguration,
* [
* SomePlugin::class,
* AnotherPlugin::class,
* ],
* $applicationConfiguration->get('APP_ENV', 'dev')
* );
*
* $kernel->run();
* ```
*
* @api
*/
interface AppKernelInterface extends KernelInterface
{
/**
Expand Down

0 comments on commit 7ebce72

Please sign in to comment.