Skip to content

The documentation for borsch skeleton

Notifications You must be signed in to change notification settings

borschphp/borsch-skeleton-website

Repository files navigation

Borsch Framework

Keep it simple.

Sometimes, you don't need an overkill solution like Laravel or Symfony.

Borsch is a simple and efficient PSR-15 micro framework made to kick start your web app or API development by using the tools you prefer, provides a DDD file structure and facilities to ease your development.

<?php

namespace Application\Handler;

use Borsch\Http\Response\HtmlResponse;
use Borsch\Template\TemplateRendererInterface;
use Borsch\Router\Attribute\{Controller, Get};
use Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
use Psr\Http\Server\RequestHandlerInterface;

#[Controller]
readonly class HomeHandler implements RequestHandlerInterface
{

    public function __construct(
        protected TemplateRendererInterface $engine
    ) {}

    #[Get(path: '/', name: 'home')]
    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $this->engine->assign([
            'name' => (
                $request->getQueryParams()['name'] ??
                $request->getHeaderLine('X-Name')
            ) ?: 'World'
        ]);

        return new HtmlResponse($this->engine->render('home.tpl'));
    }
}

Quick setup

The recommended way to install the Borsch Framework is with Composer. Get started quick using borsch-skeleton as a starting point by running the command :

composer create-project borschphp/borsch-skeleton [your-app-name]

Replace [your-app-name] with the name of your application.

You can then run it with PHP's built-in webserver :

# With built-in PHP server:
php -S 0.0.0.0:8080 -t ./public/ ./public/index.php

# Or with the composer script:
composer serve

# Or in FrankenPHP worker mode:
composer franken

You can then visit http://0.0.0.0:8080.

About

The documentation for borsch skeleton

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages