Download the PHP package designcise/bitframe without Composer
On this page you can find all versions of the php package designcise/bitframe. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package bitframe
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:
- Easy-to-learn and intuitive;
- Standards-based;
- Simple by design;
- Free of unnecessary bloat;
- Non-intrusive;
- Customizable, modular and easy-to-scale.
Prerequisites
- PHP 8.2+;
- Server with URL Rewriting (such as Apache, Nginx, etc.).
How to Get Started?
You can get started in a few simple steps:
- Setup your environment;
- Install
composer
dependencies; - Create your first "Hello World" app.
For a complete example, have a look at the simple dockerized boilerplate.
1. Setup Your Environment
You can refer to the following minimal Apache and Nginx configurations to get started:
Apache
Create an .htaccess
file with at least the following code:
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
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
):
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
You can use composer require
like so:
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 and guzzle/psr7 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
If you have ever used a middleware based framework, you will feel at ease. A "Hello World" app would look something like the following:
From the code above you can see that the application uses two middlewares:
- A PSR-15 middleware
\BitFrame\Emitter\SapiEmitter
(that comes bundled with BitFrame package) which allows to emit the HTTP Response to the requesting user-agent (such as a web browser); - A closure middleware used to write
Hello World!
to the HTTP response stream.
This is of course a very basic example. In a real-world application, the setup would be much more complex than this. For example, you could extend the functionality by using an additional PSR-15 middleware such as a router, error handler, etc. For suggestions on how to go about designing your application (and to get started quickly), have a look at the simple dockerized boilerplate example.
Tests
To run the tests you can use the following commands:
Command | Type |
---|---|
composer test |
PHPUnit tests |
composer style |
CodeSniffer |
composer style-fix |
CodeSniffer Fixer |
composer md |
MessDetector |
composer check |
PHPStan |
Contributing
Please see CONTRIBUTING for details.
- File issues at https://github.com/designcise/bitframe/issues
- Issue patches to https://github.com/designcise/bitframe/pulls
License
Please see License File for licensing information.
All versions of bitframe with dependencies
ext-json Version *
psr/container Version ^2.0
psr/http-message Version ^2.0
psr/http-factory Version ^1.0
psr/http-server-middleware Version ^1.0