ericktucto / touch
Microframework for web applications
v1.0.2-alpha
2026-04-06 17:54 UTC
Requires
- php: ^8.4
- filp/whoops: ^2.15
- guzzlehttp/psr7: ^2.5
- hassankhan/config: ^3.1
- http-interop/http-factory-guzzle: ^1.2.1
- illuminate/database: ^10.10
- itsgoingd/clockwork: ^5.1
- league/event: ^3.0
- league/route: ^5.1
- lune/http-emitter: ^0.0
- nyholm/psr7: ^1.8
- php-di/php-di: ^7.0
- psr/http-message: ^1.1
- symfony/var-dumper: ^6.2
- symfony/yaml: ^6.2
- twig/twig: ^3.0
- vlucas/valitron: ^1.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.94
- helmich/phpunit-json-assert: ^3.5
- phpunit/phpunit: ^12
- sirbrillig/phpcs-variable-analysis: ^2.0
- squizlabs/php_codesniffer: ^4.0
- vimeo/psalm: ^6.16
This package is auto-updated.
Last update: 2026-04-06 17:57:19 UTC
README
Microframework PHP, create to web applications with Touch
Table of contents
Install with Composer
composer require ericktucto/touch
Steps to create basic application
1. Create config.yml
env: local # local or production
2. Create index.php file
<?php require __DIR__ . '/../vendor/autoload.php'; use Touch\Application; use Touch\Core\Kernel; use Touch\Http\Response; $app = Application::create(new Kernel()); $app->route()->get("/", fn() => Response::html("Hello world!!!")); $app->run();
Integrated packages
- PHP Dig (dependency injection container)
- Routing by thephpleague (use psr-7 and psr-15 to middleware)
- Eloquent (ORM's Laravel)
- Twig (engine template of Symfony)
- Clockwork (debugger console)
- Valitron (validation data request)
Ecosystem
Routing
Create your routing web applications
<?php // code ... $app->route()->get("/", fn () => Response::html("My index")); $app->router()->get("/login", [AuthController::class, "login"]); // AuthController.php class AuthController { public function login(Request $request) { // code.. } }
To more infor, you'll visit docs of The php league's Routing. But Touch have some interesed features.
Response class
Routing always need a function return a variable that implements Psr\Http\Message\ResponseInterface (see doc). To make returning response, exists Touch\Http\Response
<?php // code ... // return html or text plain, $status is optional and 200 is default value $app->route("/html", fn () => Response::html("<h3>My first app</h3>", 200)); // return json, $status is optional and 200 is default value $app->route("/api/v1/json", fn () => Response::json(["message" => "It's okay"], 200); // first argument can be a object
Grouping routes
Routing can group routes (see docs), but you have Touch\Http\Route to group on class.
<?php // index file $app->group('/admin', new AdminRoutes); // AdminRoutes.php use League\Route\RouteGroup; use Touch\Http\Response; use Touch\Http\Route; class AdminRoutes extends Route { protected function routes(RouteGroup $group) { $group->get('/users', [UserController::class, "create"]); $group->get('/list-users', fn() => Response::html("<!-- list users -->")); } } // routes created // GET /admin/users -> create method of UserController class // GET /admin/list-users -> anonymous closure