1. Go to this page and download the library: Download lozitskiys/verse 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/ */
lozitskiys / verse example snippets
/** @var \Verse\Env $env */
$env = app =
// App decorator
new AppLocaleAndTz(
// App decorator
new AppSession(
// Base App implementation
new AppBase()
)
);
$action =
// Action decorator
new ActionAuthorized(
// Base Action implementation
new NumbersListJson(),
new GuestAccessLvl()
);
$app->start($action, $env, $user);
namespace Actions;
class NumbersListJson implements Action
{
public function run(Env $env, User $user): Response
{
return new RespJson([
'result' => 'ok',
'list' => [1, 2, 3, 4]
]);
}
}
class ListPosts implements Action
{
public function run(Env $env, User $user): Response
{
$tag = $env->route()->token('tag');
$author = $env->route()->token('author');
return new Response\RespHtml($env->tpl()->render(
'blog/list',
[
'posts' => (new BlogPosts($tag, $author))->list(),
'tag' => $tag,
'author' => $author
]
));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.