1. Go to this page and download the library: Download tavrin/sirius 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/ */
tavrin / sirius example snippets
use Sirius\Kernel;
use Sirius\http\Request;
DIR__) , '.env.local');
$dotenv->load();
$kernel = new Kernel();
$request = Request::create();
$response = $kernel->handleRequest($request);
$response->send();
exit();
namespace App\Entity;
class Post
{
/* Properties */
/**
* @var int
*/
private int $id;
/**
* @var string|null
*/
private ?string $title = null;
/* Methods */
public function __construct()
{
/* Properties can be set here */
$this->title = 'Default title';
}
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id)
{
$this->id = $id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title)
{
$this->title = $title;
}
}
namespace App\Repository;
use Core\database\EntityManager;
use Core\database\Repository;
class PostRepository extends Repository
{
public function __construct(?EntityManager $entityManager = null)
{
parent::__construct($entityManager, "post");
}
}