1. Go to this page and download the library: Download comfyphp/core library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
comfyphp / core example snippets
= new ComfyPHP\Core();
$router = $core->getRouter();
// search for index.php in src/pages (by default)
$router->get("/", "./index");
// return json
$router->get("/hello", function (): string {
$response = [
"message" => "Hello, World!",
];
header("Content-Type: application/json");
return json_encode($response);
});
$core->run();
= new ComfyPHP\Core();
$core->fileBasedRouter();
$core->run();