1. Go to this page and download the library: Download seymenkonuk/framework 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 HomeController extends Controller {
#[Get("/")]
public function index(Response $response){
return $response->view("home");
}
}
class UserController extends Controller {
public function __construct(
private UserRepository $users,
) {}
public function index(Response $response)
{
return $response->json(
$this->users->all()
);
}
}
$path = $request
->file("avatar")
->move("path");
class ExampleSchema extends Schema
{
public function __construct(
protected Validator $validator
) {}
public function body(): ObjectValidator
{
return $this->validator->object()->schema([
"username" => $this->validator->field()
->string()
->min(3)
->]);
}
public function files(): ObjectValidator
{
return $this->validator->object()->schema([]);
}
public function authorize(): ?array
{
if (true) {
return [
"title" => "Unauthorized",
"description" => "Bu işlem için giriş yapmalısınız."
];
}
return null;
}
}