PHP code example of larafony / empty-project

1. Go to this page and download the library: Download larafony/empty-project 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/ */

    

larafony / empty-project example snippets




namespace App\Controllers;

use Larafony\Framework\Routing\Advanced\Attributes\Route;
use Larafony\Framework\Web\Controller;
use Psr\Http\Message\ResponseInterface;

class HelloController extends Controller
{
    #[Route('/hello/{name}', 'GET')]
    public function hello(string $name): ResponseInterface
    {
        return $this->render('hello', ['name' => $name]);
    }
}