PHP code example of crimsonking / fragments
1. Go to this page and download the library: Download crimsonking/fragments 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/ */
crimsonking / fragments example snippets
namespace App\Controller;
use Fragments\Bundle\Controller\AbstractController;
use Fragments\Bundle\Attribute\Route;
use Fragments\Component\Http\Response;
class MyController extends AbstractController
{
#[Route("/", name: "main_page", methods: ["GET"])]
public function mainPage(): Response
{
// Render a template
return $this->render('main/main_page.php');
}
}