1. Go to this page and download the library: Download storinka/invoke 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/ */
storinka / invoke example snippets
use Invoke\Invoke;
function add(float $a, float $b): float
{
return $a + $b;
}
Invoke::create([
"add"
])->serve();
use Invoke\Data;
class UserResult extends Data
{
public int $id;
public string $name;
}
use Invoke\Method;
class GetUsers extends Method
{
protected function handle(int $page, int $perPage): array
{
$usersFromDB = getUsersFromDb($page, $perPage);
return UserResult::many($usersFromDB);
}
}
use Invoke\Invoke;
Invoke::create([
"getUsers" => GetUsers::class
])->serve();
shell
php -S localhost:8000 index.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.