Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-miscevic committed Mar 30, 2022
1 parent 8223d11 commit 8c320fa
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,54 @@
[![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)

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!');
}
}
```

0 comments on commit 8c320fa

Please sign in to comment.