/brutal-php-framework

Status: Work in Progress - Just our own way brutal PHP framework. Maybe you like it or maybe not!

Primary LanguagePHPMIT LicenseMIT

Brutal PHP Framework

Just our own way brutal PHP framework. Maybe you like it or maybe not!

Why Brutal PHP Framework?

This framework is for people that love coding PHP with vanilla PHP style, but want to take advantage of advanced templating mechanism (we use Twig) and advanced routing (we use Symfony routing component). For database connection you can use your own way, such as mysqli_connect, MySQL OOP style, PDO or REST or anything you like such as connection to MongoDB or ArangoDB.

Usage

  1. Clone it
git clone https://github.com/sonyarianto/brutal-php-framework.git
  1. Go to the folder
cd brutal-php-framework
  1. Install project dependencies, make sure you already install Composer, how to install composer here
composer -vvv install 
  1. Test with PHP development server
php -S 0.0.0.0:8000 -t public/
  1. Open from browser
http://localhost:8000
  1. That's it!

What next?

  • You can add some routes (on file AppRoute.php)
  • Anything you want hehehe, but later we will give more samples to give you some ideas with this framework

Some route samples

On file AppRoute.php we create some routes to give you some ideas.

  • Route / is the home page (just using echo)
  • Route /about is the about page (just using echo)
  • Route /phpinfo is display PHP info page (using phpinfo() function)
  • Route /twigsample is display data with Twig templating system (it's just simple static Twig HTML page)
  • Route /twigsamplewithdata is display data with Twig and we send some data to Twig template (it shows dynamic content on Twig)
  • Route /detail/{slug}/{id} is to show route with dynamic data plus combined with Twig templating system.
  • Route /detail/{slug}-{id} is to show alternative route with dynamic data plus with requirements on parameters plus combined with Twig templating system.

Use case

You can use this framework to create any simple web. We will give sample about this later.