1. Go to this page and download the library: Download asaokamei/slim4-starter 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/ */
asaokamei / slim4-starter example snippets
use App\Controllers\AbstractController;
class WelcomeController extends AbstractController
{
public function action() {} // <- always executed, or
public function onMethod() {} // <- executed based on HTTP method
}
class WelcomeController extends AbstractController {
public function onGet($user_id) {}
}
// 'users/{user_id}/{tags}
class WelcomeController extends AbstractController
{
public function onGet($user_id) {}
private function argUserId($user_id) {
return ['user' => $this->user->find($user_id)];
}
private function argTags($tags) {
return explode(',', $tags);
}
}
bash
cd public
php -S 127.0.0.1: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.