1. Go to this page and download the library: Download storinka/invoke-laravel 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/ */
// app/Http/Data/UserResult.php
use Invoke\Data;
class UserResult extends Data
{
public int $id;
public string $name;
public string $email;
}
// app/Http/Methods/Dec2Hex.php
use Invoke\Method;
use App\Http\Types\UserResult;
class GetUserById extends Method
{
public int $id;
protected function handle(): ?UserResult
{
$user = User::find($this->id);
return UserResult::nullable($user);
}
}