1. Go to this page and download the library: Download godie/overphp 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/ */
declare(strict_types=1);
namespace MyApp\Controllers;
final class UserController
{
public function index(): array
{
return ['users' => []];
}
public function show(string $id): array
{
return ['user_id' => $id];
}
}
bash
composer install
composer test
php -S localhost:8000 index.php
# GET http://localhost:8000/api/hello
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.