Tech News

TitleSpatie/Fork - PHP 코드를 동시 실행하기2021-07-04 23:54
Name Level 10

https://github.com/spatie/fork

- PHP 코드를 동시에 실행하게 해주는 가벼운 패키지

ㅤ→ 내부적으로 메인 PHP 프로세스를 포크해서 동작

- CLI 에서만 사용 가능

- PHP8 & pcntrl 확장을 이용


$results = Fork::new()

ㅤ->run(

ㅤㅤfn () => (new Api)->fetchData(userId: 1),

ㅤㅤfn () => (new Api)->fetchData(userId: 2),

ㅤㅤfn () => (new Api)->fetchData(userId: 3),

ㅤ);

G
M
T
Text-to-speech function is limited to 200 characters
Comment
Captcha Code
(Enter the auto register prevention code)