Simply clone the repo and start building your projects.
- BitFrame v4.0
- PHP 8.2+
- Nginx (or Apache)
- Docker Engine 1.13.0+
The following directory structure is recommended for development:
root (www)
├── client
│ ├── ...
├── public
│ ├── static
│ └── index.php
├── server
│ ├── app
│ ├── config
│ ├── helper
│ └── test
├── composer.json
└── ...
Folder | Description |
---|---|
client | Frontend app code. |
public | Publicly accessible client-facing directory. |
server | Backend app code. |
Navigate to the bitframe-boilerplate
project directory and run:
docker-compose up
Then, point your browser to access the example route /hello/test
. For example, using default nginx config in the docker container, the complete url might look something like this:
http://localhost:8000/hello/test
But this may vary depending on your server configurations.
Following would get you up to speed about the application design:
- The main app code resides in the front-controller file at
public/index.php
. - The main app code is wrapped in a self-calling anonymous function to keep the global namespace clean.
- The default controller (
BitFrame\Controller
) can be used as a service container, or you can inject your own as the first argument toBitFrame\App
. - The handy
import
function (YourProject\Helper\import
) is used to import different parts of the application. This helps reduce visual clutter and keep things maintainable. - The important directory paths are all defined as constants in
YourProject\App\Server
. - The router is programmed to automatically pick-up the action part of the url path and match it against a method inside the controller with the same name, suffixed with
Action
. - The
BitFrame\App::use()
method can be used to add middlewares. We use two middlewares in the example, one to emit the response and one for the router.
You may begin by customizing root > composer.json
:
- Add appropriate namespace to your app code by replacing
YourProject
with something else. Accordingly, please update namespaces throughout the project. A simply find / replace operation would help. - Run
composer dumpautoload
and/orcomposer update
toroot > composer.json
to see the changes.
Next you can add more middleware, routes, controllers, services, etc. and start building your project. If you wish to change the directory structure, please update the constants in YourProject\App\Server
.
Please see CONTRIBUTING for details.
- File issues at https://github.com/designcise/bitframe-boilerplate/issues
- Issue patches to https://github.com/designcise/bitframe-boilerplate/pulls
Complete documentation for Bitframe v2 will be available on https://bitframephp.com soon.
Please see License File for licensing information.