Skip to content

Commit

Permalink
Merge pull request #148 from milan-miscevic/v014
Browse files Browse the repository at this point in the history
v0.14
  • Loading branch information
milan-miscevic authored Apr 1, 2022
2 parents e299b2a + 430f3eb commit 0cb065a
Show file tree
Hide file tree
Showing 49 changed files with 660 additions and 435 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ on:
- "master"

jobs:
mutation:
name: "Infection mutation testing"
runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "8.1"

steps:
- uses: "shivammathur/setup-php@2.9.0"
with:
php-version: "${{ matrix.php-version }}"
- uses: "actions/checkout@v2"
- uses: "php-actions/composer@v1"
- env:
INFECTION_DASHBOARD_API_KEY: ${{ secrets.INFECTION_DASHBOARD_API_KEY }}
run: "vendor/bin/infection --min-msi=80"

phpstan:
name: "PHPStan static analysis"
runs-on: "ubuntu-latest"
Expand Down Expand Up @@ -70,6 +89,7 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"

steps:
- uses: "shivammathur/setup-php@2.9.0"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.php-cs-fixer.cache
/.phpunit.result.cache
/.vscode
/infection.json
/phpstan.neon
/phpunit.xml
/vendor
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->in(__DIR__ . '/view')
;

return (new PhpCsFixer\Config())
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ psalm:
standards:
$(DOCKER) run --rm $(PHP) ./vendor/bin/php-cs-fixer fix --dry-run -v

test: standards phpstan psalm coverage
test: standards unit phpstan psalm mutation

unit:
$(DOCKER) run --rm php74-cli ./vendor/bin/phpunit
Expand Down
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,58 @@
[![PDS Skeleton](https://img.shields.io/badge/pds-skeleton-blue.svg?style=flat-square)](https://github.com/php-pds/skeleton)

[![GitHub Build](https://github.com/milan-miscevic/inert/workflows/Test/badge.svg?branch=master)](https://github.com/milan-miscevic/inert/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=milan-miscevic_inert&metric=alert_status)](https://sonarcloud.io/dashboard?id=milan-miscevic_inert)
[![Type Coverage](https://shepherd.dev/github/milan-miscevic/inert/coverage.svg)](https://shepherd.dev/github/milan-miscevic/inert)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fmilan-miscevic%2Finert%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/milan-miscevic/inert/master)

This repository provides a mini PHP framework with basic MVC and service container support.
This repository provides a mini PHP framework with basic MVC and service container support. The name comes from the type of projects it is intended for - small and (almost) non-dynamic, or just inert.

## Installation
After working with full-fledged frameworks on bigger projects, it can be strange to work in vanilla PHP with `require`s and without controllers and actions. The main idea was to bring controllers and actions to small private projects to organize code but keep simplicity (of configuration) from vanilla PHP and dependencies minimal. This is how this framework was born. Later, during development, the service locator is added.

To be written...
## Minimal installation

Install Inert via Composer:

```bash
composer require milan-miscevic/inert
```

`index.php`

```php
<?php

use Mmm\Inert\ActionContainer;
use Mmm\Inert\Application;
use Mmm\Inert\ServiceContainer;

require '../vendor/autoload.php';

$actions = [
'index' => IndexAction::class,
];

$actionContainer = new ActionContainer(
$actions,
new ServiceContainer([])
);

echo (new Application($actionContainer))->run()->getContent();
```

`IndexAction.php`:

```php
<?php

use Mmm\Inert\Action;
use Mmm\Inert\Response;

class IndexAction implements Action
{
public function run(): Response
{
return new Response('Hello, world!');
}
}
```
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
}
],
"require": {
"php": "^7.4 || ^8"
"php": "^7.4 || ^8",
"psr/container": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.7.0",
"friendsofphp/php-cs-fixer": "^3.8.0",
"infection/infection": "^0.26.6",
"phpstan/phpstan": "^1.4.9",
"phpunit/phpunit": "^9.5.18",
"phpstan/phpstan": "^1.5.2",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "^9.5.19",
"vimeo/psalm": "^4.22.0"
},
"autoload": {
Expand Down
Loading

0 comments on commit 0cb065a

Please sign in to comment.