PHPackages                             designcise/bitframe - 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. designcise/bitframe

ActiveLibrary[Framework](/categories/framework)

designcise/bitframe
===================

BitFrame PHP microframework

v4.0.0(2y ago)235604[1 PRs](https://github.com/designcise/bitframe/pulls)4MITPHPPHP &gt;=8.2CI failing

Since Apr 30Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/designcise/bitframe)[ Packagist](https://packagist.org/packages/designcise/bitframe)[ RSS](/packages/designcise-bitframe/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (10)Versions (31)Used By (4)

[![CI](https://github.com/designcise/bitframe/actions/workflows/ci.yml/badge.svg)](https://github.com/designcise/bitframe/actions/workflows/ci.yml)[![Maintainability](https://camo.githubusercontent.com/68743e301084f13327f0a8a4648c902d8ae3e7dfa487796ccee1a3838893cdcf/68747470733a2f2f716c74792e73682f67682f64657369676e636973652f70726f6a656374732f6269746672616d652f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/designcise/projects/bitframe)[![Code Coverage](https://camo.githubusercontent.com/3bbc8e97b9c1c960670e10fd8e60b168f1c6ee7653e83cb8e65028f2ff630d10/68747470733a2f2f716c74792e73682f67682f64657369676e636973652f70726f6a656374732f6269746672616d652f636f7665726167652e737667)](https://qlty.sh/gh/designcise/projects/bitframe)

BitFrame PHP Microframework
===========================

[](#bitframe-php-microframework)

A highly customizable PSR-15 / PSR-7 compatible middleware-based microframework for PHP that comes bundled with a simple PSR-11 based DI container for sharing services and data across the application. It is:

1. Easy-to-learn and intuitive;
2. Standards-based;
3. Simple by design;
4. Free of unnecessary bloat;
5. Non-intrusive;
6. Customizable, modular and easy-to-scale.

Prerequisites
-------------

[](#prerequisites)

1. PHP 8.2+;
2. Server with URL Rewriting (such as Apache, Nginx, etc.).

How to Get Started?
-------------------

[](#how-to-get-started)

You can get started in a few simple steps:

1. Setup your environment;
2. Install `composer` dependencies;
3. Create your first "Hello World" app.

For a complete example, have a look at the [simple dockerized boilerplate](https://github.com/designcise/bitframe-boilerplate).

### 1. Setup Your Environment

[](#1-setup-your-environment)

You can refer to the following minimal Apache and Nginx configurations to get started:

#### Apache

[](#apache)

Create an `.htaccess` file with at least the following code:

```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

```

This sets the directive in Apache to redirect all Http requests to a front controller `index.php` file in which you can write your main application code.

#### Nginx

[](#nginx)

A configuration like the following in Nginx will help you set the directive to rewrite path to your application front controller (i.e. `index.php`):

```
server {
  listen 80;
  server_name 127.0.0.1;

  root /var/www/html/public;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php$is_args$args;
  }

  location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass app:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
  }

  access_log /var/log/nginx/access.log;
  error_log  /var/log/nginx/error.log;
}

```

Remember to make changes according to your project setup. For example, ensure that `listen`, `root`, `fastcgi_pass`, `*_log`, etc. are setup correctly according to your project.

### 2. Install Composer Dependencies

[](#2-install-composer-dependencies)

You can use `composer require` like so:

```
$ composer require "designcise/bitframe":^4.0

```

Or, alternatively, you can add the package dependency in your `composer.json` file.

Please note that you must include a PSR-17 factory in your composer dependencies. [nyholm/psr7](https://github.com/Nyholm/psr7/blob/master/src/Factory/Psr17Factory.php) and [guzzle/psr7](https://github.com/guzzle/psr7/blob/master/src/HttpFactory.php) are good examples of these — if you include either of these, they're automatically picked up by BitFrame. For any other PSR-17 factory implementation, you can add it add via `\BitFrame\Factory\HttpFactory::addFactory()` method before you instantiate `\BitFrame\App`.

### 3. Create Your First "Hello World" App

[](#3-create-your-first-hello-world-app)

If you have ever used a middleware based framework, you will feel at ease. A "Hello World" app would look something like the following:

```
