docs: Laravel example (#231)

This commit is contained in:
Kévin Dunglas
2023-10-03 17:32:17 +02:00
committed by GitHub
parent 7d41aa5243
commit 5874072d46
2 changed files with 36 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ containing [PHP 8.2](https://www.php.net/releases/8.2/en.php) and most popular P
* [Symfony](https://github.com/dunglas/symfony-docker)
* [API Platform](https://api-platform.com/docs/distribution/)
* [Laravel](docs/laravel.md)
* [Sulu](https://sulu.io/blog/running-sulu-with-frankenphp)
* [WordPress](https://github.com/dunglas/frankenphp-wordpress)
* [Drupal](https://github.com/dunglas/frankenphp-drupal)

35
docs/laravel.md Normal file
View File

@@ -0,0 +1,35 @@
# Laravel
## Docker
Serving a [Laravel](https://laravel.com) web application with FrankenPHP is as easy as mounting the project in the `/app` directory of the official Docker image.
Run this command from the main directory of your Laravel app:
```console
docker run -p 443:443 -v $PWD:/app dunglas/frankenphp
```
And enjoy!
## Local Installation
Alternatively, you can run your Laravel projects with FrankenPHP from your local machine:
1. [Download the binary corresponding to your system](https://github.com/dunglas/frankenphp/releases)
2. Add the following configuration to a file named `Caddyfile` in the root directory of your Laravel project:
```Caddyfile
{
frankenphp
order php_server before file_server
}
# The domain name of your server
localhost {
# Enable compression (optional)
encode zstd gzip
# Execute PHP files in the current directory and serve assets
php_server
}
```
3. Start FrankenPHP from the root directory of your Laravel project: `./frankenphp run`