Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/milan-miscevic/inert

Mini PHP framework with basic MVC and service container support
https://github.com/milan-miscevic/inert

action action-container controller factory framework inert mini-php-framework mvc php-framework response service-container

Last synced: 25 days ago
JSON representation

Mini PHP framework with basic MVC and service container support

Awesome Lists containing this project

README

        

# inert

[![Software License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![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. The name comes from the type of projects it is intended for - small and (almost) non-dynamic, or just inert.

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.

## Minimal installation

Install Inert via Composer:

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

`index.php`

```php
IndexAction::class,
];

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

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

`IndexAction.php`:

```php