PHPackages                             deathbeam/fwphp - 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. deathbeam/fwphp

ActiveProject[Framework](/categories/framework)

deathbeam/fwphp
===============

Blazing fast and simple PHP micro framework

v1.0.0(11y ago)1161MITPHPPHP &gt;=5.4.0

Since Sep 17Pushed 9y ago1 watchersCompare

[ Source](https://github.com/deathbeam/fwphp)[ Packagist](https://packagist.org/packages/deathbeam/fwphp)[ Docs](http://deathbeam.github.io/fwphp)[ RSS](/packages/deathbeam-fwphp/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

\#{ fw.php } code less, create more

- [Hello World](#hello-world)
- [Installation](#installation)
- [Configuration](#configuration)
- [Templates](#templates)
- [Routes](#routes)
- [API](#api)
- [License](#license)

Hello World
-----------

[](#hello-world)

To create your first hello world fw.php application, create `index.php` and add below to it

```
$fw->route('GET /@name',
    function($fw, $params) {
        echo'Hello, '.$params['name'].'!';
    }
);
```

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

[](#installation)

Copy this repo into a public accessible folder on your server (or to public\_html folder of your FTP if you are using shared hosting). There are muliple ways to get fw.php:

a) download and extract .zip /.tgz by hand

```
https://github.com/deathbeam/fwphp/archive/master.zip

```

b) cloning the repo with git

```
git clone https://github.com/deathbeam/fwphp.git /your/public/web/folder

```

c) getting the repo via Composer

```
composer create-project deathbeam/fwphp /your/public/web/folder dev-master

```

Now, we need to install `mod_rewrite` becouse it is required for `.htaccess`.

Configuration
-------------

[](#configuration)

fw.php can be configured in 2 ways. First one is using only `php` and second one is loading configuration from `json` file. In examples below, we will:

- Load `cookie.php` extension from `plugins` folder
- Change directory of public files from default `public` to `new_public_dir`
- Set `/` route to `index` function

#### Using `php` only

[](#using-php-only)

This is basic configuration from `index.php`.

```
$fw->set('public_dir', 'new_public_dir');
$fw->cookie = 'cookie.php';
$fw->route('GET /', 'index');
```

#### Using `json` configuration file

[](#using-json-configuration-file)

Below is example on how to configure fw from .json file

```
$fw->config('config.json');
```

And here is content of `config.json`

```
{
	"globals": {
		"public_dir": "new_public_dir"
	},
	"libs": {
		"cookie": "cookie.php"
	},
	"routes": {
		"GET /": "index",
	}
}
```

Templates
---------

[](#templates)

fw.php have super simple templating system using PHP as templating language.

Drawing template is simple:

```
$fw->draw('test.php');
```

Templates can read global variables set by `$fw->set` method.

#### Example template

[](#example-template)

Below, we will create simple template logic.

Code what will go into routed function in `index.php`

```
$fw
	->set('header','This is example header')
	->set('body','Content goes here')
	->set('footer','This is example footer'))
	->draw('default.php');
```

We will save code below as `default.php` to `/public` directory

```

		The Default Template

			You are viewing the default page!

```

Routes
------

[](#routes)

In fw.php I implemented routing very similar to F3 routing. Features:

- Dynamic routing with named parameters
- Reversed routing
- Flexible regular expression routing
- ReST route mapping

#### Example routing

[](#example-routing)

```
// mapping routes
$fw->route('home: GET|POST /', 'home');
$fw->route('GET /users', 'users');
$fw->route('users_show: GET /users/@id', 'showUser');
$fw->route('users_do: POST /users/@id/@action', 'userController->@action');

// provide ReST interface by mapping HTTP requests to class method
$fw->route('MAP /rest', 'some_class');

// default route (404 page)
$fw->route('default', 'error');

// redirect
$fw->reroute('users_show', array('id' => 5));
$fw->reroute('/users');
```

API
---

[](#api)

NameUsageDescription\_\_set(plugin, value)$fw-&gt;{plugin} = 'file'Loads specified plugin from plugin directory\_\_get(plugin)$plug = $fw-&gt;{plugin}Gets specified already loaded pluginset(key, value)$fw-&gt;set('key', 'value')Adds specified key to fw.ph stackget(key)$key = $fw-&gt;get('key')Gets specified key from fw.ph stackexists(key)$exists = $fw-&gt;exists('key')Checks if specified key existsclear(key)$fw-&gt;clear('key')Removes specified key from fw.php stackstack()$stack = $fw-&gt;stack()Publish stack contentshook(name, callable)$fw-&gt;hook('hook\_name') = function()Adds a new hook to fw.phpinvoke(hook, \[opt\] args)$fw-&gt;invoke('hook\_name')Invokes specified hookconfig(file)$fw-&gt;config('config.json')Configure fw.php from json configuration filedraw(template)$fw-&gt;draw('template.php')Renders specified templateroute(pattern, callable)$fw-&gt;route('GET /', function())Adds route with specified pattern and callback to routing arrayreroute(pattern, \[opt\] params)$fw-&gt;reroute('/')Redirects user to specified routeLicense
-------

[](#license)

```
Copyright (c) 2014 Thomas Slusny

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4261d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/add97404f71ea22394fc1ed241e9e0d2d472313b308b29c6015d123b4e817c1a?d=identicon)[deathbeam](/maintainers/deathbeam)

---

Top Contributors

[![deathbeam](https://avatars.githubusercontent.com/u/5115805?v=4)](https://github.com/deathbeam "deathbeam (47 commits)")

---

Tags

frameworkboilerplateapplicationSkeletonnakedbarebone

### Embed Badge

![Health badge](/badges/deathbeam-fwphp/health.svg)

```
[![Health](https://phpackages.com/badges/deathbeam-fwphp/health.svg)](https://phpackages.com/packages/deathbeam-fwphp)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
