Download the PHP package bjornbasar/karhu-skeleton without Composer
On this page you can find all versions of the php package bjornbasar/karhu-skeleton. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bjornbasar/karhu-skeleton
More information about bjornbasar/karhu-skeleton
Files in bjornbasar/karhu-skeleton
Package karhu-skeleton
Short Description Skeleton app for the karhu PHP microframework
License MIT
Informations about the package karhu-skeleton
karhu-skeleton
Starter app template for the karhu PHP microframework. Boots a working app with one HTTP route and one CLI command — meant to be cloned and edited.
Quick start
You'll see the HomeController rendering at /. Try the CLI too:
The value must be passed as --name=…: HelloCommand reads $args['name'], so a bare
karhu hello YourName lands in $args['0'] and prints Hello, world! instead.
Which karhu you get
This template requires bjornbasar/karhu: ^0.1.5 — a release, from Packagist. It previously
tracked dev-main with minimum-stability: dev, which meant a fresh clone installed whatever
happened to be at the tip of the framework's default branch. That is a poor default for a
starter template: two people cloning a week apart got different frameworks, and neither got
something they could reproduce.
^0.1.5 is also what makes vendor/bin/karhu above work at all. Composer only links that shim
because karhu declares a bin key, which landed in v0.1.5.
karhu is pre-1.0, so a 0.x minor release may break the API — bump this pin deliberately rather
than widening it.
What you get
The front controller is three lines:
karhu reads #[Route] attributes off the registered controllers — no YAML, no closures.
Add a route
-
Drop a controller into
app/Controllers/:Three things are easy to guess wrong here: the path is the first argument to
#[Route](methodsis a named argument after it), handlers receive theRequestrather than unpacked route parameters, andjson()is an instance method onResponse, not a static one. - Register it in
config/controllers.php:
That's it. Same shape for #[Command] CLI handlers in config/commands.php.
Tests
Documentation
- DOCS.md — design decisions, structure, deployment notes
- karhu — framework reference
- istrbuddy — full example app built on top of this skeleton
License
MIT