• Stars
    star
    117
  • Rank 300,867 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 5 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A minimal, highly performant middleware PSR-15 microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.

chubbyphp-framework

CI Coverage Status Infection MSI Latest Stable Version Total Downloads Monthly Downloads

bugs code_smells coverage duplicated_lines_density ncloc sqale_rating alert_status reliability_rating security_rating sqale_index vulnerabilities

Description

A minimal, highly performant middleware PSR-15 microframework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.

Workflow

Requirements

Suggest

Router

Any Router which implements Chubbyphp\Framework\Router\RouteMatcherInterface can be used.

PSR 7 / PSR 17

Installation

Through Composer as chubbyphp/chubbyphp-framework.

composer require chubbyphp/chubbyphp-framework "^5.0" \
    chubbyphp/chubbyphp-framework-router-fastroute "^2.0" \
    slim/psr7 "^1.5"

Usage

<?php

declare(strict_types=1);

namespace App;

use Chubbyphp\Framework\Application;
use Chubbyphp\Framework\Middleware\ExceptionMiddleware;
use Chubbyphp\Framework\Middleware\RouteMatcherMiddleware;
use Chubbyphp\Framework\RequestHandler\CallbackRequestHandler;
use Chubbyphp\Framework\Router\FastRoute\RouteMatcher;
use Chubbyphp\Framework\Router\Route;
use Chubbyphp\Framework\Router\RoutesByName;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Psr7\Factory\ResponseFactory;
use Slim\Psr7\Factory\ServerRequestFactory;

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

$responseFactory = new ResponseFactory();

$app = new Application([
    new ExceptionMiddleware($responseFactory, true),
    new RouteMatcherMiddleware(new RouteMatcher(new RoutesByName([
        Route::get('/hello/{name:[a-z]+}', 'hello', new CallbackRequestHandler(
            static function (ServerRequestInterface $request) use ($responseFactory) {
                $response = $responseFactory->createResponse();
                $response->getBody()->write(sprintf('Hello, %s', $request->getAttribute('name')));

                return $response;
            }
        ))
    ]))),
]);

$app->emit($app->handle((new ServerRequestFactory())->createFromGlobals()));

Emitter

Middleware

RequestHandler

Router

Server

Skeleton

Migration

Copyright

2023 Dominik Zogg

More Repositories

1

petstore

A simple skeleton to build api's based on the chubbyphp-framework, mezzio (former zend-expressive) or slim.
PHP
36
star
2

chubbyphp-serialization

A simple serialization.
PHP
27
star
3

chubbyphp-swoole-request-handler

A request handler adapter for swoole, using PSR-7, PSR-15 and PSR-17.
PHP
26
star
4

chubbyphp-container

A minimal Dependency Injection Container (DIC) which implements PSR-11.
PHP
14
star
5

chubbyphp-workerman-request-handler

A request handler adapter for workerman, using PSR-7, PSR-15 and PSR-17.
PHP
11
star
6

chubbyphp-laminas-config-doctrine

Doctrine service factories for the laminas/laminas-servicemanager and any other dependency injection container who's been able to handle it's config, like chubbyphp/chubbyphp-container via chubbyphp/chubbyphp-laminas-config and many (Aura.Di, Pimple, Auryn, Symfony, PHP-DI) more.
PHP
8
star
7

chubbyphp-deserialization

A simple deserialization.
PHP
7
star
8

chubbyphp-parsing

Allows parsing data of various structures, meaning the population and validation of data into a defined structure. For example, converting an API request into a Data Transfer Object (DTO).
PHP
6
star
9

chubbyphp-cors

A minimal CORS middleware for PSR 15.
PHP
4
star
10

chubbyphp-mock

A helper trait simplify mocking within phpunit.
PHP
3
star
11

chubbyphp-laminas-config-factory

An abstract service factory for the laminas/laminas-servicemanager and any other dependency injection container who's been able to handle it's config, like chubbyphp/chubbyphp-container via chubbyphp/chubbyphp-laminas-config and many (Aura.Di, Pimple, Auryn, Symfony, PHP-DI) more.
PHP
3
star
12

chubbyphp-negotiation

A simple negotiation library.
PHP
2
star
13

chubbyphp-static-file

A minimal static file middleware for PSR 15.
PHP
2
star
14

chubbyphp-framework-skeleton

A minimal skeleton to start with a minimal php project.
PHP
1
star
15

chubbyphp-dev-helper

A dev helper which provides coding standards and quality settings.
PHP
1
star
16

chubbyphp-framework-router-fastroute

Fastroute Router implementation for chubbyphp-framework.
PHP
1
star