1. Go to this page and download the library: Download nations-original/sf 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/ */
nations-original / sf example snippets
use PHP_SF\System\Attributes\Route;
#[Route(url: 'posts/{id}', httpMethod: 'GET', name: 'post_show')]
public function show(int $id): Response { ... }
use PHP_SF\System\Classes\Abstracts\AbstractController;
use PHP_SF\System\Attributes\Route;
class PostController extends AbstractController
{
#[Route(url: 'posts', httpMethod: 'GET', name: 'post_index')]
public function post_list_view(): Response
{
return $this->render(new post_list_view());
}
#[Route(url: 'api/posts', httpMethod: 'GET', name: 'api_post_index')]
public function api_posts(): Response
{
return $this->ok(['posts' => [...]]);
}
}
use PHP_SF\System\Classes\Abstracts\AbstractEntity;
use PHP_SF\System\Attributes\Validator as Validate;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PostRepository::class)]
class Post extends AbstractEntity
{
#[ORM\Column]
#[Validate\Length(min: 3, max: 255)]
#[TranslatablePropertyName]
protected string $title;
}