Download the PHP package alencarfreire/stem without Composer

On this page you can find all versions of the php package alencarfreire/stem. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package stem

StemPHP

Tests Packagist PHP Docs

Ultralight executable routing-tree micro-framework for PHP 8.3+. Inspired by Roda (Ruby). Zero runtime dependencies.

Docs: English · Português (Brasil) · llms.txt

Indicated app layout (PDO, not an ORM): Architecture.

Runs on PHP-FPM, php -S, Apache, FrankenPHP (with or without worker mode), RoadRunner, and Swoole. FrankenPHP is an optional fast path, not a requirement.

Routing tree

The route closure runs on every request. Matchers consume the remaining path. A match finishes that level; siblings do not run. Total miss → 404. Branch taken, leftover path → 404. Wrong method → 405 + Allow.

Call Meaning
$r->on('users', $cb) Prefix. Consumes users, enters the branch.
$r->is('users', $cb) Exact remaining path /users.
$r->is($cb) Remaining path is empty.
$r->get($cb) / post / put / delete / patch HTTP method and remaining path empty.
$r->get('users', $cb) Method + exact remaining /users.
$r->root($cb) Remaining path is / or empty (any method).
$r->onInt($cb) Prefix: next segment is an integer (0, 42; not 01, -1).
$r->isInt($cb) Exact remaining integer (not /users/1/posts).
$r->onParam($cb) Prefix: next non-empty segment, as string.
$r->isParam($cb) Exact remaining one segment.
$r->run($branch) Run function (Request $r) on the current path; does not seal on miss.
$r->branches(['users' => $cb]) O(1) lookup of the next segment (Roda hash_branches).
$r->onUuid($cb) / $r->isUuid($cb) UUID segment, prefix or exact.
$r->when($pred, $cb) Run $cb and seal if $pred() is true.
$r->ctx($key) / $r->ctx($key, $value) Request-scoped context bag.
$r->json($data, $status = 200) JSON body + Content-Type. Sets $done. Does not throw.
$r->html($html, $status = 200) HTML body. Sets $done. Does not throw.
$r->halt($status, $body, $headers) Early exit (never). Throws an internal HaltException.
$r->redirect($url, $status = 302) Location.
$r->noContent() HTTP 204.
$r->jsonBody() / queryParam / formParam / bearerToken Request helpers. Invalid JSON → halt(400).

Matchers do not inject Request as an argument (no Reflection on the hot path). Use use ($r) or arrow functions, which already capture $r from the route() closure. Captures (onInt / onParam) are the only extra arguments.

Request isolation

App stores only the route closure. Each handle() gets a new Request; Response is created on first write. No static request state. Safe for FrankenPHP worker mode, RoadRunner, and Swoole.

Request::fromGlobals() must be called inside the per-request handler, never at worker boot.

Deploy

PHP-FPM / php -S (default)

Save the app as index.php next to vendor/ and serve it as the front controller (php -S localhost:8080 index.php, or point PHP-FPM/Apache at that file).

FrankenPHP worker mode (optional)

$app is created outside the loop. See examples/frankenphp/.

RoadRunner / Swoole

App::handle() is the runtime contract. Convert the incoming request to Request::create(...), then write $response->status(), headers(), and body(). See examples/roadrunner/ and examples/swoole/. Those packages are not Composer requirements.

Performance

StemPHP matches Roda's model: routing cost is O(path depth × siblings at that level), not O(total routes). It is not a compiled matcher (FastRoute / Symfony Routing). The hot path has no regex, no Reflection, and no exception on json() / html().

Per-request work that is not on the matching path is deferred or skipped:

Measured on FrankenPHP worker (4 workers, JIT, SQLite WAL, wrk -t4 -c20 -d10s, Docker): Stem 7,283 req/s read vs Flight 6,776 vs Slim 6,251, lower p50 and less CPU. Tables and methodology: docs #performance. Do not invent numbers; measure your own index.php.

Development

Requires PHP 8.3+. CI runs 8.3 and 8.4.

AI agents

License

MIT


All versions of stem with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alencarfreire/stem contains the following files

Loading the files please wait ...