papimod/common

Module Papi

Installs: 23

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/papimod/common

v2.1.1 2025-12-20 11:06 UTC

This package is auto-updated.

Last update: 2025-12-20 11:11:39 UTC


README

Description

Help configuring middlewares provided by Slim in your papi.

Prerequisites Modules

Configuration

ALLOW_BODY_PARSING (.ENV)

Required No
Type int
Description Allow body parsing middleware
Default 1

ALLOW_ROUTING (.ENV)

Required No
Type int
Description Allow routing middleware
Default 1

Definitions

Usage

Module

You can add the following options to your .env file:

ALLOW_ROUTING=1
ALLOW_BODY_PARSING=1

Import the module when creating your application:

require __DIR__ . "/../vendor/autoload.php";

use Papi\PapiBuilder;
use Papimod\Dotenv\DotEnvModule;
use Papimod\Common\CommonModule;
use function DI\create;

$builder = new PapiBuilder();

$builder
    ->setModule(
        DotEnvModule::class, # Prerequisite
        CommonModule::class
    )
    ->build()
    ->run();

Custom implementation

You can also import only the items of your choice:

require __DIR__ . "/../vendor/autoload.php";

use Papi\PapiBuilder;
use Papimod\Dotenv\DotEnvModule;
use Papimod\Common\middleware\RoutingMiddleware;
use function DI\create;

$builder = new PapiBuilder();

$builder
    ->setMiddleware(RoutingMiddleware::class)
    ->build()
    ->run();