PHPackages                             infocyph/webrick - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. infocyph/webrick

ActiveLibrary[Framework](/categories/framework)

infocyph/webrick
================

A fast, modern PHP router with production-grade middleware, signed &amp; temporary URLs, smart responses and first-class route caching.

3.2.1(2w ago)12.6k↓31.7%1MITPHPPHP &gt;=8.4CI passing

Since Oct 22Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/infocyph/Webrick)[ Packagist](https://packagist.org/packages/infocyph/webrick)[ RSS](/packages/infocyph-webrick/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (6)Dependencies (20)Versions (20)Used By (1)

Webrick
=======

[](#webrick)

A framework-neutral HTTP routing kernel for PHP with deploy-time route compilation, lazy middleware resolution, signed URLs, response helpers and emitters for traditional and persistent runtimes.

[![Security & Standards](https://github.com/infocyph/Webrick/actions/workflows/security-standards.yml/badge.svg)](https://github.com/infocyph/Webrick/actions/workflows/security-standards.yml)[![Packagist Downloads](https://camo.githubusercontent.com/e81eea4af3244d79b1c4c4d0de073202a55225be0ed006ceb4a507c369db4fb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e666f637970682f7765627269636b3f636f6c6f723d677265656e266c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b61676573253246696e666f637970682532467765627269636b)](https://camo.githubusercontent.com/e81eea4af3244d79b1c4c4d0de073202a55225be0ed006ceb4a507c369db4fb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e666f637970682f7765627269636b3f636f6c6f723d677265656e266c696e6b3d68747470732533412532462532467061636b61676973742e6f72672532467061636b61676573253246696e666f637970682532467765627269636b)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![Packagist Version](https://camo.githubusercontent.com/ad56b0a2a41c9d9dc85f3bca6c67431c53e6f8370a954a23968bcf70ca208af7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e666f637970682f7765627269636b)](https://camo.githubusercontent.com/ad56b0a2a41c9d9dc85f3bca6c67431c53e6f8370a954a23968bcf70ca208af7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e666f637970682f7765627269636b)[![Packagist PHP Version](https://camo.githubusercontent.com/e0e6814e2cd3d85beec2f7c9ba79f0e9696bc93d2a3b17bb5f1ffee267187edd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f696e666f637970682f7765627269636b2f706870)](https://camo.githubusercontent.com/e0e6814e2cd3d85beec2f7c9ba79f0e9696bc93d2a3b17bb5f1ffee267187edd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f696e666f637970682f7765627269636b2f706870)[![GitHub Code Size](https://camo.githubusercontent.com/2916b8628d87dc996bc42a8e574825c3fe6f553a1a867c6bd718029948fda050/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f696e666f637970682f5765627269636b)](https://camo.githubusercontent.com/2916b8628d87dc996bc42a8e574825c3fe6f553a1a867c6bd718029948fda050/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f696e666f637970682f5765627269636b)[![Documentation](https://camo.githubusercontent.com/ea5425f990b45c310432223acddf7d89af769d24a1fd44a27e6332889871279d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f63756d656e746174696f6e2d5765627269636b2d626c75653f6c6f676f3d72656164746865646f6373266c6f676f436f6c6f723d7768697465)](https://docs.infocyph.com/projects/webrick/en/latest/)

Highlights
----------

[](#highlights)

- Fast routing: named routes, groups, domains, resources, attribute discovery
- Framework-neutral: run Webrick standalone or mount it behind another framework's request/response adapter
- Deploy-time compilation: sharded, fused and generated PHP route-cache artifacts
- Lean cached dispatch: class handlers and string middleware stay scalar until the matched route is materialized
- Lazy optional services: middleware alias families and URL generation are resolved only when used
- DI-aware dispatch: constructor and method injection through InterMix, with request scopes and service providers
- Signed URLs: permanent, TTL-based, or explicit-expiry links
- Rich signing controls: relative or absolute payloads, ignored query params, key rotation, custom signature params and algorithms
- Central error boundary: framework middleware throws typed HTTP exceptions and the kernel renders them just before emission
- User controllers and user middleware can still return `Response` directly; only framework-owned rejection paths are exception-driven
- Response helpers: JSON, plaintext, redirects, streaming, ranged file/download responses, views
- Middleware pipeline: negotiation, compression, throttling, validators, telemetry, cookie encryption and more
- Runtime emitters: PHP-FPM, FrankenPHP, LiteSpeed, Nginx Unit, CLI, Swoole, RoadRunner and Workerman

Requirements
------------

[](#requirements)

- PHP 8.4+
- Composer 2.x

Installation
------------

[](#installation)

```
composer require infocyph/webrick
```

Core routing does not install or initialize CacheLayer. Add CacheLayer 2 only when using `ResponseCacheMiddleware`, the default throttle cache backend, or CacheLayer's atomic counter backend:

```
composer require "infocyph/cachelayer:^2.0.1"
```

`ThrottleMiddleware` can also run without CacheLayer when the application supplies its own PSR-6 cache pool.

Webrick is a library, not an application skeleton. Its directory layout, configuration source, container composition and deployment entry point remain under the host application's control.

Minimal Boot Example
--------------------

[](#minimal-boot-example)

```
