-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
3,153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
{$CADDY_GLOBAL_OPTIONS} | ||
|
||
frankenphp { | ||
# worker /srv/www/worker.php | ||
{$FRANKENPHP_CONFIG} | ||
} | ||
order php_server before file_server | ||
} | ||
|
||
{$CADDY_EXTRA_CONFIG} | ||
|
||
{$SERVER_NAME:localhost} { | ||
root * /srv/www/ | ||
|
||
{$CADDY_SERVER_EXTRA_DIRECTIVES} | ||
|
||
@indexFiles file { | ||
try_files {path} worker.php | ||
split_path .php | ||
} | ||
rewrite @indexFiles {http.matchers.file.relative} | ||
|
||
encode zstd gzip | ||
php_server | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM dunglas/frankenphp:1.0.0-beta.2-bookworm | ||
|
||
RUN echo "variables_order = \"EGPCS\"" >> $PHP_INI_DIR/conf.d/990-php.ini | ||
|
||
RUN install-php-extensions xdebug | ||
|
||
RUN echo "[xdebug]" >> $PHP_INI_DIR/conf.d/991-xdebug.ini && \ | ||
echo "xdebug.mode=debug" >> $PHP_INI_DIR/conf.d/991-xdebug.ini && \ | ||
echo "xdebug.client_host=host.docker.internal" >> $PHP_INI_DIR/conf.d/991-xdebug.ini && \ | ||
echo "xdebug.start_with_request=yes" >> $PHP_INI_DIR/conf.d/991-xdebug.ini | ||
|
||
WORKDIR /srv | ||
|
||
COPY . /srv | ||
COPY .docker/Caddyfile /etc/caddy/Caddyfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
indent_size = tab | ||
tab_width = 4 | ||
|
||
[{*.json, *.yaml, *.yml, *.md}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version = 1 | ||
|
||
[merge] | ||
automerge_label = "automerge" | ||
blacklist_title_regex = "^WIP.*" | ||
blacklist_labels = ["WIP"] | ||
method = "rebase" | ||
delete_branch_on_merge = true | ||
notify_on_conflict = true | ||
optimistic_updates = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: composer | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
labels: | ||
- "dependencies" | ||
- "automerge" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: "Codesniffer" | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
branches: ["*"] | ||
|
||
schedule: | ||
- cron: "0 8 * * 1" | ||
|
||
jobs: | ||
codesniffer: | ||
name: "Codesniffer" | ||
uses: contributte/.github/.github/workflows/codesniffer.yml@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "Coverage" | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
branches: ["*"] | ||
|
||
schedule: | ||
- cron: "0 8 * * 1" | ||
|
||
jobs: | ||
coverage: | ||
name: "Phpunit" | ||
uses: contributte/.github/.github/workflows/phpunit-coverage.yml@v1 | ||
with: | ||
make: "init coverage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "Phpstan" | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
branches: ["*"] | ||
|
||
schedule: | ||
- cron: "0 8 * * 1" | ||
|
||
jobs: | ||
phpstan: | ||
name: "Phpstan" | ||
uses: contributte/.github/.github/workflows/phpstan.yml@v1 | ||
with: | ||
make: "init phpstan" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "Phpunit" | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
branches: [ "*" ] | ||
|
||
schedule: | ||
- cron: "0 8 * * 1" | ||
|
||
jobs: | ||
test82: | ||
name: "Phpunit" | ||
uses: contributte/.github/.github/workflows/phpunit.yml@v1 | ||
with: | ||
php: "8.2" | ||
make: "init tests" | ||
|
||
test81: | ||
name: "Phpunit" | ||
uses: contributte/.github/.github/workflows/phpunit.yml@v1 | ||
with: | ||
php: "8.1" | ||
make: "init tests" | ||
|
||
testlower: | ||
name: "Phpunit" | ||
uses: contributte/.github/.github/workflows/phpunit.yml@v1 | ||
with: | ||
php: "8.1" | ||
make: "init tests" | ||
composer: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable --prefer-lowest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# IDE | ||
/.idea | ||
|
||
# Composer | ||
/vendor | ||
|
||
# Apache | ||
!.htaccess | ||
|
||
# Nette | ||
/config/local.neon | ||
/var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
DOCKER_IMAGE=contributte/frankenphp | ||
DOCKER_VERSION=latest | ||
|
||
############################################################ | ||
# PROJECT ################################################## | ||
############################################################ | ||
.PHONY: project | ||
project: install setup | ||
|
||
.PHONY: init | ||
init: | ||
cp config/local.neon.example config/local.neon | ||
|
||
.PHONY: install | ||
install: | ||
composer install | ||
|
||
.PHONY: setup | ||
setup: | ||
mkdir -p var/tmp var/log | ||
chmod +0777 var/tmp var/log | ||
|
||
.PHONY: clean | ||
clean: | ||
find var/tmp -mindepth 1 ! -name '.gitignore' -type f,d -exec rm -rf {} + | ||
find var/log -mindepth 1 ! -name '.gitignore' -type f,d -exec rm -rf {} + | ||
|
||
############################################################ | ||
# DEVELOPMENT ############################################## | ||
############################################################ | ||
.PHONY: qa | ||
qa: cs phpstan | ||
|
||
.PHONY: cs | ||
cs: | ||
vendor/bin/codesniffer app tests | ||
|
||
.PHONY: csf | ||
csf: | ||
vendor/bin/codefixer app tests | ||
|
||
.PHONY: phpstan | ||
phpstan: | ||
vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=512M | ||
|
||
.PHONY: tests | ||
tests: | ||
vendor/bin/tester -s -p php --colors 1 -C tests | ||
|
||
.PHONY: coverage | ||
coverage: | ||
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./app tests | ||
|
||
.PHONY: dev | ||
dev: | ||
NETTE_DEBUG=1 NETTE_ENV=dev php -S 0.0.0.0:8000 -t www | ||
|
||
.PHONY: build | ||
build: | ||
echo "OK" | ||
|
||
############################################################ | ||
# DOCKER ################################################### | ||
############################################################ | ||
.PHONY: docker-up | ||
docker-up: | ||
docker compose up | ||
|
||
.PHONY: docker-build | ||
docker-build: | ||
docker build -t ${DOCKER_IMAGE}:${DOCKER_VERSION} -f .docker/Dockerfile . | ||
|
||
.PHONY: docker-in | ||
docker-in: | ||
docker compose exec app bash | ||
|
||
############################################################ | ||
# DEPLOYMENT ############################################### | ||
############################################################ | ||
.PHONY: deploy | ||
deploy: | ||
$(MAKE) clean | ||
$(MAKE) project | ||
$(MAKE) build | ||
$(MAKE) clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
![](https://heatbadger.now.sh/github/readme/contributte/demo-frankenphp/) | ||
|
||
<p align=center> | ||
<a href="https://github.com/contributte/demo-frankenphp/actions"><img src="https://badgen.net/github/checks/contributte/demo-frankenphp/master"></a> | ||
<a href="https://coveralls.io/r/contributte/demo-frankenphp"><img src="https://badgen.net/coveralls/c/github/contributte/demo-frankenphp"></a> | ||
<a href="https://packagist.org/packages/contributte/demo-frankenphp"><img src="https://badgen.net/packagist/dm/contributte/demo-frankenphp"></a> | ||
<a href="https://packagist.org/packages/contributte/demo-frankenphp"><img src="https://badgen.net/packagist/v/contributte/demo-frankenphp"></a> | ||
</p> | ||
<p align=center> | ||
<a href="https://packagist.org/packages/contributte/demo-frankenphp"><img src="https://badgen.net/packagist/php/contributte/demo-frankenphp"></a> | ||
<a href="https://github.com/contributte/demo-frankenphp"><img src="https://badgen.net/github/license/contributte/demo-frankenphp"></a> | ||
<a href="https://bit.ly/ctteg"><img src="https://badgen.net/badge/support/gitter/cyan"></a> | ||
<a href="https://bit.ly/cttfo"><img src="https://badgen.net/badge/support/forum/yellow"></a> | ||
<a href="https://contributte.org/partners.html"><img src="https://badgen.net/badge/sponsor/donations/F96854"></a> | ||
</p> | ||
|
||
<p align=center> | ||
Website 🚀 <a href="https://contributte.org">contributte.org</a> | Contact 👨🏻💻 <a href="https://f3l1x.io">f3l1x.io</a> | Twitter 🐦 <a href="https://twitter.com/contributte">@contributte</a> | ||
</p> | ||
|
||
<p align=center> | ||
<img src="https://api.microlink.io?url=https%3A%2F%2Fexamples.contributte.org%2Fsentry-skeleton%2F&overlay.browser=light&screenshot=true&meta=false&embed=screenshot.url"></img> | ||
</p> | ||
|
||
----- | ||
|
||
## Goal | ||
|
||
Main goal is to provide example of [Nette Framework](https://nette.org) with [FrankenPHP](https://github.com/dunglas/frankenphp). | ||
|
||
## Installation | ||
|
||
You will need `PHP 8.2+` and [Composer](https://getcomposer.org/). | ||
|
||
Clone project using Git. | ||
|
||
```sh | ||
clone [email protected]:contributte/demo-frankenphp.git | ||
``` | ||
|
||
Install Composer dependencies. | ||
|
||
```sh | ||
make install | ||
# composer install | ||
``` | ||
|
||
## Startup | ||
|
||
The easiest way is to use php built-in web server. | ||
|
||
```bash | ||
make dev | ||
# php -S 0.0.0.0:8000 -t www | ||
``` | ||
|
||
Then visit [http://localhost:8000](http://localhost:8000) in your browser. | ||
|
||
## Development | ||
|
||
See [how to contribute](https://contributte.org/contributing.html) to this package. | ||
|
||
This package is currently maintaining by these authors. | ||
|
||
<a href="https://github.com/f3l1x"> | ||
<img width="80" height="80" src="https://avatars2.githubusercontent.com/u/538058?v=3&s=80"> | ||
</a> | ||
|
||
----- | ||
|
||
Consider to [support](https://contributte.org/partners.html) **contributte** development team. Also thank you for using this project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace App; | ||
|
||
use Contributte\Bootstrap\ExtraConfigurator; | ||
use Contributte\Nella\Boot\Bootloader; | ||
use Contributte\Nella\Boot\Preset\NellaPreset; | ||
use Nette\Application\Application; | ||
|
||
final class Bootstrap | ||
{ | ||
|
||
public static function boot(): ExtraConfigurator | ||
{ | ||
return Bootloader::create() | ||
->use(NellaPreset::create(__DIR__)) | ||
->boot() | ||
->setDebugMode(true); | ||
} | ||
|
||
public static function run(): void | ||
{ | ||
self::boot() | ||
->createContainer() | ||
->getByType(Application::class) | ||
->run(); | ||
} | ||
|
||
} |
Oops, something went wrong.