PHP code example of mades / summer-craft-service-hub
1. Go to this page and download the library: Download mades/summer-craft-service-hub 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/ */
class Article extends Record
{
public ?int $id = null;
public string $title = '';
public string $body = '';
}
/** @extends RelationalStorage<Article> */
class ArticleRepository extends RelationalStorage
{
public function __construct(RequestScope $scope)
{
parent::__construct($scope, new RelationalStorageConfig(
Article::class,
RelationalDatabaseHandler::class, // which handler service to run on
'articles',
'id',
['id'],
));
}
public function newInstance(): Article
{
return Article::emptyRecord();
}
}