# Spatie/Fork - PHP 코드를 동시 실행하기

> Clean Markdown view of GeekNews topic #4552. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=4552](https://news.hada.io/topic?id=4552)
- GeekNews Markdown: [https://news.hada.io/topic/4552.md](https://news.hada.io/topic/4552.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2021-07-04T10:08:37+09:00
- Updated: 2021-07-04T10:08:37+09:00
- Original source: [github.com](https://github.com/spatie/fork)
- Points: 5
- Comments: 0

## Topic Body

- 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),

ㅤ);

## Comments



_No public comments on this page._
