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
Requires
- papi/papi: ^2.1.0
- papimod/dotenv: ^2.1.0
Requires (Dev)
- phpunit/phpunit: ^12.5.2
- squizlabs/php_codesniffer: ^4.0.1
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();