Skip to content

Commit

Permalink
docs: add docs about the standalone binary
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Dec 6, 2023
1 parent 6366db3 commit 586984e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ FrankenPHP can also be used as a standalone Go library to embed PHP in any app u

## Getting Started

### Docker

```console
docker run -v $PWD:/app/public \
-p 80:80 -p 443:443 \
Expand All @@ -24,10 +26,26 @@ docker run -v $PWD:/app/public \

Go to `https://localhost`, and enjoy!

> [!TIP]
>
> Do not attempt to use `https://127.0.0.1`. Use `localhost` and accept the self-signed certificate. Caddy has an automatic TLS handling that auto-trusts some local-based hostnames like `localhost`, but it does not apply to IP addresses. More details [on Caddy's "automatic https" docs](https://caddyserver.com/docs/automatic-https#hostname-requirements).
### Standalone Binary

If you prefer not to use Docker, we provide standalone FrankenPHP binaries for Linux and macOS
containing [PHP 8.3](https://www.php.net/releases/8.3/en.php) and most popular PHP extensions: [Download FrankenPHP](https://github.com/dunglas/frankenphp/releases)

> Note: do not attempt to use `https://127.0.0.1`. Use `localhost` and accept the self-signed certificate. Caddy has an automatic TLS handling that auto-trusts some local-based hostnames like `localhost`, but it does not apply to IP addresses. More details [on Caddy's "automatic https" docs](https://caddyserver.com/docs/automatic-https#hostname-requirements).
To serve the content of the current directory, run:

```console
./frankenphp php-server
```

You can also run command-line scripts with:

```console
./frankenphp php-cli /path/to/your/script.php
```

## Docs

Expand Down
24 changes: 23 additions & 1 deletion docs/worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
Boot your application once and keep it in memory.
FrankenPHP will handle incoming requests in a few milliseconds.

## Starting Worker Scripts

### Docker

Set the value of the `FRANKENPHP_CONFIG` environment variable to `worker /path/to/your/worker/script.php`:

```console
docker run \
-e APP_RUNTIME=Runtime\\FrankenPhpSymfony\\Runtime \
-v $PWD:/app \
-p 80:80 -p 443:443 \
dunglas/frankenphp
```

### Standalone Binary

Use the `--worker` option of the `php-server` command to serve the content of the current directory using a worker:

```console
./frankenphp php-server --worker /path/to/your/worker/script.php
```

## Symfony Runtime

The worker mode of FrankenPHP is supported by the [Symfony Runtime Component](https://symfony.com/doc/current/components/runtime.html).
Expand All @@ -12,7 +34,7 @@ To start any Symfony application in a worker, install the FrankenPHP package of
composer require runtime/frankenphp-symfony
```

Start your app server by defining the `APP_RUNTIME` environment variable to use the FrankenPHP Symfony Runtime
Start your app server by defining the `APP_RUNTIME` environment variable to use the FrankenPHP Symfony Runtime:

```console
docker run \
Expand Down

0 comments on commit 586984e

Please sign in to comment.