A tiny web application framework with big ambitions.
Haku is a small, opinionated web application framework built for JSON APIs. It aims to have a small footprint without any external dependencies or extensions, relying on native PHP 8.4 features.
Note
Make sure you have PHP 8.4 or newer installed with mbstring and PDO PHP Extension.
gh repo clone hejrobin/haku project-name
# or via ssh
# git clone git@github.com:hejrobin/haku.git project-name
cd project-name
php haku-init
Haku aims to have a small footprint, without any external dependencies and relies soley on the power of native PHP 8.4 features.
Haku ships with a simple test/spec runner inspired by Jest. Writing tests for your code should be quick and easy, Haku tries to help with that.
Ships with a tiny command line interface, a built in development server and code generators.
| Command | Description |
|---|---|
php haku-init |
Initial setup, creates required configuration files |
php haku env |
Creates, or refreshes an already defined environment |
php haku version |
Shows current haku version. And if framework needs upgrade |
php haku upgrade |
Downloads and upgrades current framework with latest release. |
php haku release |
Makes a new Haku release, support bumping with --major, --minor or --patch. |
php haku okidoki |
Generates documentation for Haku packages. |
| Command | Description |
|---|---|
php haku serve |
Starts a development server using PHP's built in server. |
php haku routes |
Lists all available routes based on defined application routes. |
php haku test |
Runs all available *.spec.php tests in the workspace, you can control what tests to run with the flags --only or --omit. |
php haku migrate |
Runs any viable migration, default to up, can be downgraded with --down. If --seed is passed, it will also run seed. |
php haku make |
Invokes one of the code generators that Haku ships with, run php haku make --help to see available generators. |
Tip
If you need any help with commands, just add --help and it'll output documentation for each command. For more help, see Commands
I wanted to build a framework that has a "batteries included" kind of philosophy, without external dependencies, just the bare minimum needed to create a JSON API.
While Composer is an amazing and convenient tool, it isn't really the approach I wanted for Haku.
Yes, Haku follows PSR-1.
👋🏻 Happy coding!