Search by

mako / haste

freost

(Experimental) Boost your application performance by running it on a application server like FrankenPHP

dev-master / 1.0.x-dev 2026-10-17 12:31 UTC

This package is auto-updated.

Last update: 2026-10-17 12:32:01 UTC


README

Static analysis

The mako/haste package allows you to boost your application performance by running it on an application server like FrankenPHP.

The performance gains will vary based on the application but a basic "Hello, world!" application will run about 4-5 times faster than on a php+apache setup.

It is important to make sure that you do not leak data between requests by using static variables!

Requirements

  • Mako ^12.0|^13.0

Installation

First you'll need to install the package as a dependency to your project.

composer require mako/haste

Next you'll have to replace the index.php contents with the following.

<?php

use mako\haste\FrankenPhp;
use mako\application\web\Application;

/**
 * Include the application init file.
 */
include dirname(__DIR__) . '/app/init.php';

/*
 * Start and run the application.
 */
FrankenPhp::run(new Application(MAKO_APPLICATION_PATH));

That's it! Enjoy your (hopefully) improved performance 🎉

Docker setup

The following basic dockerfile will help to get you started:

FROM dunglas/frankenphp:1.11.2-php8.5

ARG USER=haste

RUN install-php-extensions \
	opcache \
	pdo_mysql

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

COPY . /app

RUN mv ./php-overrides.ini /usr/local/etc/php/conf.d/.

RUN useradd ${USER}
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp
RUN chown -R ${USER}:${USER} /data/caddy && chown -R ${USER}:${USER} /config/caddy
RUN chown -R ${USER}:${USER} ./app/storage

USER ${USER}

ENV SERVER_NAME=:80
ENV FRANKENPHP_CONFIG="worker ./public/index.php"
#ENV CADDY_GLOBAL_OPTIONS="debug"

Note that the example setup includes a php-overrides.ini file with custom OPcache settings for optimal performance. These settings should work well in most cases, but feel free to customize them as needed.

expose_php = Off
zend.exception_ignore_args=0
memory_limit=512M
register_argc_argv = Off

opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0