Skip to content

Commit f6f1123

Browse files
authored
Merge pull request #7 from Micro-PHP/v1.6-release
v1.6.0 released
2 parents fa11812 + b3bb00c commit f6f1123

18 files changed

+442
-247
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.github export-ignore
2+
/tests export-ignore
3+
/phpunit.xml.dist export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.php-cs-fixer.dist.php export-ignore
7+
/psalm.xml export-ignore
8+
9+
*.php diff=php

.github/workflows/.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[{*.yaml,*.yml}]
2+
indent_size = 2

.github/workflows/ci.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Plugin CI
2+
on:
3+
push:
4+
branches: [ 'master' ]
5+
pull_request:
6+
7+
env:
8+
PHP_CS_FIXER_IGNORE_ENV: 1
9+
XDEBUG_MODE: coverage
10+
11+
jobs:
12+
tests:
13+
name: "Tests ${{ matrix.php-version }} deps ${{ matrix.dependency-versions }}"
14+
runs-on: ubuntu-22.04
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
# normal, highest, non-dev installs
20+
php-version: [ '8.2' ]
21+
dependency-versions: [ 'highest' ]
22+
include:
23+
# testing lowest PHP version with the lowest dependencies
24+
# - php-version: '8.2'
25+
# dependency-versions: 'lowest'
26+
27+
# testing dev versions with the highest PHP
28+
- php-version: '8.2'
29+
dependency-versions: 'highest'
30+
31+
steps:
32+
- name: "Checkout code"
33+
uses: "actions/checkout@v2"
34+
35+
- name: "Install PHP"
36+
uses: "shivammathur/setup-php@v2"
37+
with:
38+
coverage: "none"
39+
php-version: "${{ matrix.php-version }}"
40+
41+
- name: "Composer install"
42+
uses: "ramsey/composer-install@v2"
43+
with:
44+
dependency-versions: "${{ matrix.dependency-versions }}"
45+
composer-options: "--prefer-dist --no-progress"
46+
47+
- name: Run tests
48+
run: composer run test

.gitignore

100755100644
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
.phpdoc/
2-
docs/
3-
vendor/
1+
.idea
2+
vendor
43
composer.lock
54
.phpunit.result.cache
5+
.php-cs-fixer.cache
6+
test-coverage-report
7+
phpunit.xml
8+
.php-cs-fixer.php
9+
phpstan.neon

.php-cs-fixer.dist.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
if (!file_exists(__DIR__.'/src')) {
4+
exit(0);
5+
}
6+
7+
$finder = (new PhpCsFixer\Finder())
8+
->in(__DIR__.'/src')
9+
->in(__DIR__.'/tests')
10+
;
11+
12+
return (new PhpCsFixer\Config())
13+
->setRules(array(
14+
'@Symfony' => true,
15+
'@Symfony:risky' => true,
16+
'protected_to_private' => false,
17+
'semicolon_after_instruction' => false,
18+
'header_comment' => [
19+
'header' => <<<EOF
20+
This file is part of the Micro framework package.
21+
22+
(c) Stanislau Komar <[email protected]>
23+
24+
For the full copyright and license information, please view the LICENSE
25+
file that was distributed with this source code.
26+
EOF
27+
]
28+
))
29+
->setRiskyAllowed(true)
30+
->setFinder($finder);

README.md

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,3 @@
11
# Micro Framework - The minimum kernel for application initialization.
22

3-
### Requirements
4-
5-
PHP >= 8.0.0
6-
7-
### How to use the library
8-
9-
Add the latest version of micro/kernel into your project by using Composer or manually:
10-
11-
__Using Composer (Recommended)__
12-
13-
Or require the package inside the composer.json of your project:
14-
```
15-
"require": {
16-
"micro/kernel": "^1"
17-
},
18-
```
19-
20-
### Example
21-
22-
After adding the library to your project, include the file autoload.php found in root of the library.
23-
```html
24-
include 'vendor/autoload.php';
25-
```
26-
27-
#### Simple usage:
28-
29-
```php
30-
31-
use Micro\Framework\Kernel\Configuration\DefaultApplicationConfiguration;
32-
use Micro\Framework\Kernel\Plugin\PluginDependedInterface;
33-
use Micro\Framework\Kernel\Plugin\ApplicationPluginInterface;
34-
use Micro\Component\DependencyInjection\Container;
35-
use Micro\Framework\Kernel\Plugin\PluginBootLoaderInterface;
36-
use Micro\Framework\Kernel\KernelBuilder;
37-
38-
// Create simple plugin
39-
class TestPlugin implements PluginDependedInterface
40-
{
41-
public function provideDependencies(Container $container): void
42-
{
43-
print_r('Provided dependencies');
44-
}
45-
}
46-
47-
// Create Dependency provider boot loader
48-
class DependencyProviderLoader implements PluginBootLoaderInterface
49-
{
50-
51-
public function __construct(private readonly Container $container)
52-
{
53-
}
54-
55-
public function boot(ApplicationPluginInterface $applicationPlugin): void
56-
{
57-
$applicationPlugin->getDependedPlugins($this->container);
58-
}
59-
}
60-
61-
$kernelBuilder = new KernelBuilder();
62-
$container = new Container();
63-
$configuration = new DefaultApplicationConfiguration(['APP_ENV' => 'dev']);
64-
$kernel = $kernelBuilder
65-
->setApplicationConfiguration($configuration)
66-
->setContainer($container)
67-
->setApplicationPlugins([
68-
TestPlugin::class
69-
])
70-
->addBootLoaders([
71-
new DependencyProviderLoader($container)
72-
])
73-
->build();
74-
;
75-
76-
$kernel->run();
77-
```
78-
79-
## License
80-
81-
[MIT](LICENSE)
3+
Documentation is available [here](https://micro-php.net/docs). If not, we will be grateful if you can become its author :)

composer.json

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,60 @@
11
{
22
"name": "micro/kernel",
3-
"type": "library",
43
"description": "",
5-
"version": "1.3",
64
"license": "MIT",
7-
"autoload": {
8-
"psr-4": {
9-
"Micro\\Framework\\Kernel\\": "src/"
10-
}
11-
},
5+
"type": "library",
126
"authors": [
137
{
148
"name": "Stanislau.Komar",
159
"email": "[email protected]"
1610
}
1711
],
1812
"require": {
19-
"php": "^8.1|^8.2",
13+
"php": "^8.2",
2014
"micro/dependency-injection": "^1"
15+
},
16+
"require-dev": {
17+
"ergebnis/composer-normalize": "^2.29",
18+
"friendsofphp/php-cs-fixer": "^3.13",
19+
"phpstan/phpstan": "^1.9",
20+
"phpunit/php-code-coverage": "^9.2",
21+
"phpunit/phpunit": "^9.5",
22+
"vimeo/psalm": "^5.2"
23+
},
24+
"autoload": {
25+
"psr-4": {
26+
"Micro\\Framework\\Kernel\\": "src/"
27+
}
28+
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"Micro\\Framework\\Kernel\\Test\\Unit\\": "tests/Unit"
32+
}
33+
},
34+
"config": {
35+
"allow-plugins": {
36+
"ergebnis/composer-normalize": true
37+
},
38+
"sort-packages": true
39+
},
40+
"scripts": {
41+
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text",
42+
"coverage-html": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html ./test-coverage-report",
43+
"php-cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --using-cache=no",
44+
"php-cs-try": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no",
45+
"phpstan": "./vendor/bin/phpstan analyze --no-progress",
46+
"phpunit": "./vendor/bin/phpunit",
47+
"psalm": "./vendor/bin/psalm --no-progress --show-info=true --no-cache",
48+
"statics": [
49+
"@phpstan",
50+
"@psalm",
51+
"@php-cs-try"
52+
],
53+
"test": [
54+
"@statics",
55+
"composer validate --strict",
56+
"composer normalize",
57+
"@coverage"
58+
]
2159
}
2260
}

phpstan.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 7
3+
paths:
4+
- src

phpunit.xml.dist

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- https://phpunit.readthedocs.io/en/9.5/configuration.html#the-phpunit-element -->
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
5+
backupGlobals="false"
6+
bootstrap="vendor/autoload.php"
7+
colors="true"
8+
failOnRisky="true"
9+
failOnWarning="true"
10+
>
11+
<php>
12+
<ini name="error_reporting" value="-1" force="true"/>
13+
</php>
14+
<testsuites>
15+
<testsuite name="Unit tests">
16+
<directory>tests/Unit</directory>
17+
</testsuite>
18+
</testsuites>
19+
<filter>
20+
<whitelist>
21+
<directory suffix=".php">src/</directory>
22+
<exclude>
23+
<directory>src/Exception</directory>
24+
<file>src/HttpCorePlugin.php</file>
25+
</exclude>
26+
</whitelist>
27+
</filter>
28+
<coverage>
29+
<include>
30+
<directory suffix=".php">src</directory>
31+
</include>
32+
<report>
33+
<html outputDirectory="test-coverage-report/" />
34+
</report>
35+
</coverage>
36+
</phpunit>

psalm.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="2"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
>
9+
<projectFiles>
10+
<directory name="src" />
11+
<ignoreFiles>
12+
<directory name="vendor" />
13+
</ignoreFiles>
14+
15+
</projectFiles>
16+
17+
</psalm>

0 commit comments

Comments
 (0)