Welcome
Froq! is a PHP framework that helps you quickly create simple yet powerful web applications and APIs with a minimal installation / configuration process. It basically accepts HTTP requests, applies some method / callback routines, and returns HTTP responses.
Froq! neither follows MVC architecture rules nor contains a Model component, but instead, it makes use of Controller, Repository and View components.
Froq! can also be used as a micro framework that you might be familiar with Slim framework.
How does it work?
After applying web server configurations, Froq! can be installed and run easily. Here is a HelloController
example:
// app/config/routes.php
'/hello/:name' => 'Hello.say',
// app/system/HelloController.php
namespace app\controller;
class HelloController extends \froq\app\Controller {
function sayAction(string $name): void {
echo "Hello, ", escape($name), "!\n";
}
}
And as mentioned before, you can also use Froq! as a micro framework. Just open pub/index.php
file and add your routes with callbacks as below:
$app->get('/hello/:name', function (string $name): void {
echo "Hello, ", escape($name), "!\n";
});
Note: The escape()
function doesn't exist in Froq! but is used there just because to emphasise that the $name
variable is an external input (path / segment parameter).