1. Go to this page and download the library: Download suvera/winter-boot 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/ */
suvera / winter-boot example snippets
t
#[WinterBootApplication]
class MyApplication {
public static function main() {
(new WinterWebSwooleApplication())->run(MyApplication::class);
}
}
MyApplication::main();
t
#[Service]
class UserServiceImpl implements UserService {
#[Autowired]
private PdbcTemplate $pdbc;
public function createUser(string $name, string $email) {
$this->pdbc->update(/* ... */);
}
}
--------------------------------------------------------------------
#[RestController]
class MyController {
#[Autowired]
private UserService $userService;
#[RequestMapping(path: "/api/v2/users", method: [RequestMethod::POST]]
public function createUser(
#[RequestParam] string $name,
#[RequestParam] string $email
): ResponseEntity {
$this->userService->createUser($name, $email);
return ResponseEntity::ok()->withJson($someJsonArray);
}
}
# curl command
curl "http://localhost/api/v2/users" -d "name=Abc&email=mail"
t
# Symfony Security component
composer t
composer /arrays --prefer-dist
t
class WinterWebSwooleApplication extends WinterApplicationRunner implements WinterApplication {
}
t
class WinterWebWorkermanApplication extends WinterApplicationRunner implements WinterApplication {
}
class WinterRoadRunnerApplication extends WinterApplicationRunner implements WinterApplication {
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.