Skip to content

Commit 5ffb360

Browse files
author
FungY911
committed
FixedWebserver
1 parent 051657f commit 5ffb360

File tree

613 files changed

+151044
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

613 files changed

+151044
-349
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{html}]
12+
indent_style = tab
13+
indent_size = tab
14+
tab_width = 4
15+
16+
[*.{js,ts,json,yml,yaml,md}]
17+
indent_style = space
18+
indent_size = 2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Vercel
2+
.vercel

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 FungY911
3+
Copyright (c) 2019 Juicy(fx)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.PHONY: deploy
2+
.PHONY: php php-composer
3+
.PHONY: php-laminas php-laravel php-lumen php-nette-tracy php-phalcon php-satis php-slim php-symfony-micro1 php-symfony-micro2
4+
5+
deploy:
6+
cd ${PROJECT} && vc -c -n ${PROJECT} -S xorg ${NOW}
7+
8+
deploy-all:
9+
$(MAKE) cache
10+
$(MAKE) php
11+
$(MAKE) php-composer
12+
$(MAKE) php-laminas
13+
$(MAKE) php-laravel
14+
$(MAKE) php-lumen
15+
$(MAKE) php-nette-tracy
16+
$(MAKE) php-phalcon
17+
$(MAKE) php-satis
18+
$(MAKE) php-slim
19+
$(MAKE) php-sqlite
20+
$(MAKE) php-symfony-micro1
21+
$(MAKE) php-symfony-micro2
22+
23+
##################
24+
# Basic examples #
25+
##################
26+
27+
php:
28+
PROJECT=php $(MAKE) deploy
29+
30+
php-composer:
31+
PROJECT=php-composer $(MAKE) deploy
32+
33+
##################
34+
# Basic examples #
35+
##################
36+
37+
php-laminas:
38+
PROJECT=php-laminas $(MAKE) deploy
39+
40+
php-laravel:
41+
PROJECT=php-laravel $(MAKE) deploy
42+
43+
php-lumen:
44+
PROJECT=php-lumen $(MAKE) deploy
45+
46+
php-nette-tracy:
47+
PROJECT=php-nette-tracy $(MAKE) deploy
48+
49+
php-phalcon:
50+
PROJECT=php-phalcon $(MAKE) deploy
51+
52+
php-satis:
53+
PROJECT=php-satis $(MAKE) deploy
54+
55+
php-slim:
56+
PROJECT=php-slim $(MAKE) deploy
57+
58+
php-sqlite:
59+
PROJECT=php-sqlite $(MAKE) deploy
60+
61+
php-symfony-micro1:
62+
PROJECT=php-symfony-micro1 $(MAKE) deploy
63+
64+
php-symfony-micro2:
65+
PROJECT=php-symfony-micro2 $(MAKE) deploy

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<h1 align=center>Examples & Sample Projects for <a href="https://vercel.com">Vercel</a></h1>
2+
3+
<p align=center>
4+
📦 Included examples of PHP Runtime (<a href="https://github.com/juicyfx/vercel-php">vercel-php</a>).
5+
</p>
6+
7+
<p align=center>
8+
🕹 <a href="https://f3l1x.io">f3l1x.io</a> | 💻 <a href="https://github.com/f3l1x">f3l1x</a> | 🐦 <a href="https://twitter.com/xf3l1x">@xf3l1x</a>
9+
</p>
10+
11+
---
12+
13+
## ⚙️ Usage
14+
15+
1. Clone repository `git clone [email protected]:juicyfx/vercel-examples.git`.
16+
2. Browse single example, `cd /php`.
17+
3. Deploy to Vercel, `vercel`.
18+
19+
## 🚀 Click & Go
20+
21+
Fastest way how to deploy example project is using following deploy button. It deploys you example PHP project.
22+
23+
<a href="https://vercel.com/new/clone?demo-description=Static%20frontend%20with%20PHP%20function.&demo-title=PHP&demo-url=https%3A%2F%2Fphp.vercel.app&project-name=vercel-php&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp&repository-name=vercel-php&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**PHP**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350"><img src="https://vercel.com/button" height="24"></a>
24+
25+
## 📦 Examples
26+
27+
| Example | Description | Demo | Deploy |
28+
| ------------------------------------------------- | ------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29+
| [PHP](/php) | Static frontend with PHP function. | [👀🕶](https://php.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Static%20frontend%20with%20PHP%20function.&demo-title=PHP&demo-url=https%3A%2F%2Fphp.vercel.app&project-name=vercel-php&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp&repository-name=vercel-php&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**PHP**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
30+
| [PHP - Composer](/php-composer) | Install dependencies using Composer | [👀🕶](https://php-composer-demo.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Install%20dependencies%20using%20Composer&demo-title=Composer&demo-url=https%3A%2F%2Fphp-composer-demo.vercel.app&project-name=vercel-php-composer&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-composer&repository-name=vercel-php-composer&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Composer**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
31+
| [PHP - Laminas](/php-laminas) | Laminas components and MVC | [👀🕶](https://php-laminas.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Laminas%20components%20and%20MVC&demo-title=Laminas&demo-url=https%3A%2F%2Fphp-laminas.vercel.app&project-name=vercel-php-laminas&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-laminas&repository-name=vercel-php-laminas&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Laminas**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
32+
| [PHP - Laravel](/php-laravel) | Laravel - The PHP Framework For Web Artisans | [👀🕶](https://php-laravel.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Laravel%20-%20The%20PHP%20Framework%20For%20Web%20Artisans&demo-title=Laravel&demo-url=https%3A%2F%2Fphp-laravel.vercel.app&project-name=vercel-php-laravel&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-laravel&repository-name=vercel-php-laravel&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Laravel**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
33+
| [PHP - Lumen](/php-lumen) | Lumen - PHP Micro-Framework By Laravel | [👀🕶](https://php-lumen.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Lumen%20-%20PHP%20Micro-Framework%20By%20Laravel&demo-title=Lumen&demo-url=https%3A%2F%2Fphp-lumen.vercel.app&project-name=vercel-php-lumen&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-lumen&repository-name=vercel-php-lumen&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Lumen**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
34+
| [PHP - Nette Tracy](/php-nette-tracy) | Tracy Debugging Tools by Nette. | [👀🕶](https://php-nette-tracy.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Tracy%20Debugging%20Tools%20by%20Nette.&demo-title=Nette%20Tracy&demo-url=https%3A%2F%2Fphp-nette-tracy.vercel.app&project-name=vercel-php-nette-tracy&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-nette-tracy&repository-name=vercel-php-nette-tracy&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Nette%20Tracy**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
35+
| [PHP - Phalcon](/php-phalcon) | Phalcon Framework: High Performance PHP Framework | [👀🕶](https://php-phalcon.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Phalcon%20Framework%3A%20High%20Performance%20PHP%20Framework&demo-title=Phalcon&demo-url=https%3A%2F%2Fphp-phalcon.vercel.app&project-name=vercel-php-phalcon&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-phalcon&repository-name=vercel-php-phalcon&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Phalcon**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
36+
| [PHP - Satis](/php-satis) | Composer Satis | [👀🕶](https://php-satis.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Composer%20Satis&demo-title=Satis&demo-url=https%3A%2F%2Fphp-satis.vercel.app&project-name=vercel-php-satis&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-satis&repository-name=vercel-php-satis&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Satis**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
37+
| [PHP - Slim](/php-slim) | Slim Framework | [👀🕶](https://php-slim.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=Slim%20Framework&demo-title=Slim&demo-url=https%3A%2F%2Fphp-slim.vercel.app&project-name=vercel-php-slim&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-slim&repository-name=vercel-php-slim&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Slim**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
38+
| [PHP - Sqlite](/php-sqlite) | PHP + SQlite | [👀🕶](https://php-sqlite.vercel.app) | [▲▲▲](https://vercel.com/new/clone?demo-description=PHP%20%2B%20SQlite&demo-title=Sqlite&demo-url=https%3A%2F%2Fphp-sqlite.vercel.app&project-name=vercel-php-sqlite&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-sqlite&repository-name=vercel-php-sqlite&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Sqlite**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350) |
39+
| [PHP - Symfony Micro (vol1)](/php-symfony-micro1) | Symfony with MicroKernelTrait | [👀🕶](https://php-symfony-micro1.vercel.app/) | [▲▲▲](<https://vercel.com/new/clone?demo-description=Symfony%20with%20MicroKernelTrait&demo-title=Symfony%20Micro%20(vol1)&demo-url=https%3A%2F%2Fphp-symfony-micro1.vercel.app%2F&project-name=vercel-php-symfony-micro1&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-symfony-micro1&repository-name=vercel-php-symfony-micro1&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Symfony%20Micro%20(vol1)**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350>) |
40+
| [PHP - Symfony Micro (vol2)](/php-symfony-micro2) | Symfony with MicroKernelTrait | [👀🕶](https://php-symfony-micro2.vercel.app/) | [▲▲▲](<https://vercel.com/new/clone?demo-description=Symfony%20with%20MicroKernelTrait&demo-title=Symfony%20Micro%20(vol2)&demo-url=https%3A%2F%2Fphp-symfony-micro2.vercel.app%2F&project-name=vercel-php-symfony-micro2&s=https%3A%2F%2Fgithub.com%2Fjuicyfx%2Fvercel-examples%2Ftree%2Fmaster%2Fphp-symfony-micro2&repository-name=vercel-php-symfony-micro2&from=templates&demo-image=https%3A%2F%2Fog-image.vercel.app%2F**Vercel**%2520%252B%2520**Symfony%20Micro%20(vol2)**.jpeg%3Ftheme%3Dlight%26md%3D1%26fontSize%3D100px%26images%3Dhttps%253A%252F%252Fassets.vercel.com%252Fimage%252Fupload%252Ffront%252Fassets%252Fdesign%252Fvercel-triangle-black.svg%26images%3Dhttps%253A%252F%252Fsimpleicons.vercel.app%252Fphp%252F595C96%26heights%3D200%26heights%3D350>) |
41+
42+
## 📝 License
43+
44+
Copyright © 2019 [f3l1x](https://github.com/f3l1x).
45+
This project is [MIT](LICENSE) licensed.

cache/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# NodeJS
2+
/node_modules
3+
4+
# App
5+
/dist
6+
7+
# Vercel
8+
.vercel

cache/.vercelignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
/node_modules

cache/api/index.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { NowRequest, NowResponse } from '@vercel/node';
2+
3+
const CACHE_BROWSER = 60 * 60 * 24 * 1; // 1 day
4+
const CACHE_CDN = 60 * 60 * 24 * 5; // 5 days
5+
6+
export default async function handler(req: NowRequest, res: NowResponse) {
7+
console.log("HTTP", req.url);
8+
9+
// Apply optimistic CORS
10+
res.setHeader("Access-Control-Allow-Origin", '*');
11+
res.setHeader("Access-Control-Allow-Methods", '*');
12+
res.setHeader("Access-Control-Allow-Headers", '*');
13+
14+
// OPTIONS request
15+
if (req.method === 'OPTIONS') {
16+
res.statusCode = 200;
17+
res.end();
18+
return
19+
}
20+
21+
const output = {
22+
timestamp: Date.now(),
23+
date: new Date().toISOString()
24+
}
25+
26+
res.setHeader('Content-Type', 'application/json')
27+
res.setHeader('Cache-Control', `max-age=${CACHE_BROWSER}, s-maxage=${CACHE_CDN}, public`);
28+
res.send(JSON.stringify(output));
29+
}

0 commit comments

Comments
 (0)