1. Go to this page and download the library: Download lark/app 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/ */
lark / app example snippets
namespace App\Middleware;
use Lark\Request;
use Lark\Response;
class UserMiddleware
{
public function auth(Request $req, Response $res): void
{
// auth here
}
}
namespace App;
use Lark\Response;
abstract class Controller
{
protected Response $res;
public function __construct()
{
$this->res = res();
}
}
namespace App\Controller;
use App\Model\Item as ItemModel;
class ItemsController extends \App\Controller
{
private ItemModel $model;
public function __construct()
{
$this->model = new ItemModel;
}
public function get(): void
{
$this->res->json(
$this->model->find()
);
}
}