1
- <h1 align =center >ZEIT Now PHP </h1 >
1
+ <h1 align =center >PHP Runtime for < a href = " https://vercel.com " >Vercel </h1 >
2
2
3
3
<p align =center >
4
- Enjoyable & powerful 🐘 PHP Runtime (<a href =" https://php.now.sh " >php.now.sh</a >) for ZEIT Now.
4
+ Enjoyable & powerful 🐘 PHP Runtime (<a href =" https://php.vercel.app " >php.vercel.app</a >) for Vercel platform.
5
+ <a href =" https://vercel.com/new/project?template=https://github.com/juicyfx/vercel-examples/tree/master/php " ><img src =" https://vercel.com/button " ></a >
5
6
</p >
6
7
7
8
<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
- <p align =center >
12
- <a href =" https://www.npmjs.com/package/now-php " ><img alt =" npm " src =" https://img.shields.io/npm/dt/now-php?style=flat-square " ></a >
13
- <a href =" https://www.npmjs.com/package/now-php " ><img alt =" npm (latest) " src =" https://img.shields.io/npm/v/now-php/latest?style=flat-square " ></a >
9
+ <a href =" https://www.npmjs.com/package/vercel-php " ><img src =" https://badgen.net/npm/v/vercel-php " ></a >
10
+ <a href =" https://www.npmjs.com/package/vercel-php " ><img src =" https://badgen.net/npm/dt/vercel-php " ></a >
11
+ <a href =" https://www.npmjs.com/package/vercel-php " ><img src =" https://badgen.net/github/status/juicyfx/vercel-php/master " ></a >
14
12
</p >
15
13
16
14
<p align =center >
@@ -21,24 +19,63 @@ Enjoyable & powerful 🐘 PHP Runtime (<a href="https://php.now.sh">php.now.sh</
21
19
<a href =" https://github.com/phalcon " ><img src =" https://github.com/phalcon.png " width =" 128 " ></a >
22
20
</p >
23
21
24
- <p align =center ><strong >🏋️♀️ It works with these frameworks and tools. Discover more at <a href =" https://github.com/juicyfx/now-examples " >examples</strong >.</p >
22
+ <p align =center ><strong >🏋️♀️ It works with these frameworks and tools. Discover more at <a href =" https://github.com/juicyfx/vercel-examples " >examples</strong >.</p >
23
+
24
+ -----
25
+
26
+ <p align =center >
27
+ Made with ❤️ by <a href =" https://github.com/f3l1x " >@f3l1x </a > 🕹 <a href =" https://f3l1x.io " >f3l1x.io</a > 🐦 <a href =" https://twitter.com/xf3l1x " >@xf3l1x </a >
28
+ </p >
25
29
26
30
-----
27
31
28
- ## 🐣 Versions
32
+ Let's picture you want to deploy your awesome microproject written in PHP and you don't know where. You have found [ Vercel] ( https://vercel.com ) it's awesome, but for static sites. Not anymore! I would like to introduce you your new best friend ` vercel-php ` , PHP runtime for Vercel platform.
33
+
34
+ Most simple example project is this one, using following project structure.
35
+
36
+ ``` sh
37
+ project
38
+ ├── api
39
+ │ └── index.php
40
+ └── now.json
41
+ ```
42
+
43
+ First file ` api/index.php ` is entrypoint of our application. It should be placed in ** api** folder, it's very standard location for Vercel.
44
+
45
+ ``` php
46
+ <?php
47
+ phpinfo();
48
+ ```
49
+
50
+ Second file ` now.json ` is pure gold here. Setup your project with configuration like this and voila. That's all.
51
+
52
+ ``` json
53
+ {
54
+ "functions" : {
55
+ "api/*.php" : {
56
+
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ Last thing you have to do is call ` now ` . If you are more interested take a look at features and usage.
29
63
30
- | | Pkg | Tag | Stability | Info |
31
- | ----| ---------| --------------| -------------| --------------------------|
32
- | ✅ | now-php | latest | production | Rock-solid stable. |
33
- | 🔥 | now-php | canary | testing | For early-adopters. |
34
- | ⚠️ | now-php | experimental | development | Testing and high danger. |
64
+ ```
65
+ # Install it globally
66
+ npm i -g now
35
67
36
- > Need to know how things are changing? Here is [ changelog] ( ./CHANGELOG.md ) .
68
+ # Log in
69
+ now login
70
+
71
+ # Let's fly
72
+ now
73
+ ```
37
74
38
75
## 🤗 Features
39
76
40
77
- ** Architecture** : PHP development server (🚀 fast enough)
41
- - ** PHP version** : 7.4.4
78
+ - ** PHP version** : 7.4.7
42
79
- ** Extensions** : apcu, bcmath, brotli, bz2, calendar, Core, ctype, curl, date, dom, ds, exif, fileinfo, filter, ftp, gettext, hash, iconv, igbinary, imap, intl, json, libxml, lua, mbstring, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, protobuf, psr, readline, redis, Reflection, runkit7, session, SimpleXML, soap, sockets, sodium, SPL, sqlite3, standard, swoole, timecop, tokenizer, uuid, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zlib
43
80
- ** Speed** : cold ~ 250ms / warm ~ 5ms
44
81
- ** Memory** : ~ 90mb
@@ -48,15 +85,24 @@ Enjoyable & powerful 🐘 PHP Runtime (<a href="https://php.now.sh">php.now.sh</
48
85
49
86
## ⚙️ Usage
50
87
51
- Take a look at [ ZEIT 's] ( https://zeit.co ) blogpost about [ ` Serverless Functions ` ] ( https://zeit.co /blog/customizing-serverless-functions ) .
88
+ Take a look at [ Vercel 's] ( https://vercel.com ) blogpost about [ ` Serverless Functions ` ] ( https://vercel.com /blog/customizing-serverless-functions ) .
52
89
53
90
You should define ` functions ` property in ` now.json ` and list PHP files directly or using wildcard (* ).
54
91
55
92
``` json
56
93
{
57
94
"functions" : {
58
95
"api/*.php" : {
59
-
96
+
97
+ },
98
+
99
+ // Can be list directly also
100
+
101
+ "api/one.php" : {
102
+
103
+ },
104
+ "api/two.php" : {
105
+
60
106
}
61
107
}
62
108
}
@@ -68,7 +114,7 @@ If you need to show index page define `routes` properly.
68
114
{
69
115
"functions" : {
70
116
"api/index.php" : {
71
- "runtime" : " now -php@0.0.10 "
117
+ "runtime" : " vercel -php@0.1.0 "
72
118
}
73
119
},
74
120
"routes" : [
@@ -77,50 +123,51 @@ If you need to show index page define `routes` properly.
77
123
}
78
124
```
79
125
80
- Additional function properties are ` memory ` , ` maxDuration ` .
126
+ Additional function properties are ` memory ` , ` maxDuration ` . Learn more about [ functions ] ( https://vercel.com/docs/configuration#project/functions ) .
81
127
82
128
``` json
83
129
{
84
130
"functions" : {
85
131
"api/*.php" : {
86
- "runtime" : " now -php@0.0.10 " ,
132
+ "runtime" : " vercel -php@0.1.0 " ,
87
133
"memory" : 3008 ,
88
134
"maxDuration" : 500
89
135
}
90
136
}
91
137
}
92
138
```
93
139
94
- ** Click & Go**
95
-
96
- [ ![ Deploy with ZEIT Now] ( https://zeit.co/button )] ( https://zeit.co/new/project?template=https://github.com/juicyfx/now-examples/tree/master/php )
97
-
98
140
## 👨💻` now dev `
99
141
100
142
For running ` now dev ` properly, you need to have PHP installed on your computer, [ learn more] ( errors/now-dev-no-local-php.md ) .
143
+ But it's PHP and as you know PHP has built-in development server. It works out of box.
144
+
145
+ ```
146
+ php -S localhost:8000 api/index.php
147
+ ```
101
148
102
149
## 👀 Demo
103
150
104
- - official - https://php.now.sh /
105
- - phpinfo - https://php.jfx.cz /
106
- - extensions - https://php.jfx.cz /ext/
107
- - ini - https://php.jfx.cz /ini/
108
- - JSON API - https://php.jfx.cz /api/users.php
109
- - test - https://php.jfx.cz /test.php
151
+ - official - https://php.vercel.app /
152
+ - phpinfo - https://phpshow.vercel.app /
153
+ - extensions - https://phpshow.vercel.app /ext/
154
+ - ini - https://phpshow.vercel.app /ini/
155
+ - JSON API - https://phpshow.vercel.app /api/users.php
156
+ - test - https://phpshow.vercel.app /test.php
110
157
111
158
![ ] ( docs/phpinfo.png )
112
159
113
160
## 🎯Examples
114
161
115
- - [ PHP - fast & simple] ( https://github.com/juicyfx/now -examples/tree/master/php/ )
116
- - [ Composer - install dependencies] ( https://github.com/juicyfx/now -examples/tree/master/php-composer/ )
117
- - [ Framework - Lumen] ( https://github.com/juicyfx/now -examples/tree/master/php-framework-lumen/ )
118
- - [ Framework - Nette] ( https://github.com/juicyfx/now -examples/tree/master/php-framework-nette/ )
119
- - [ Framework - Slim] ( https://github.com/juicyfx/now -examples/tree/master/php-framework-slim/ )
120
- - [ Framework - Symfony - Microservice] ( https://github.com/juicyfx/now -examples/tree/master/php-framework-symfony-microservice/ )
121
- - [ Framework - Phalcon] ( https://github.com/juicyfx/now -examples/tree/master/php-framework-phalcon/ )
162
+ - [ PHP - fast & simple] ( https://github.com/juicyfx/vercel -examples/tree/master/php/ )
163
+ - [ Composer - install dependencies] ( https://github.com/juicyfx/vercel -examples/tree/master/php-composer/ )
164
+ - [ Framework - Lumen] ( https://github.com/juicyfx/vercel -examples/tree/master/php-framework-lumen/ )
165
+ - [ Framework - Nette] ( https://github.com/juicyfx/vercel -examples/tree/master/php-framework-nette/ )
166
+ - [ Framework - Slim] ( https://github.com/juicyfx/vercel -examples/tree/master/php-framework-slim/ )
167
+ - [ Framework - Symfony - Microservice] ( https://github.com/juicyfx/vercel -examples/tree/master/php-framework-symfony-microservice/ )
168
+ - [ Framework - Phalcon] ( https://github.com/juicyfx/vercel -examples/tree/master/php-framework-phalcon/ )
122
169
123
- Browse [ more examples] ( https://github.com/juicyfx/now -examples ) . 👀
170
+ Browse [ more examples] ( https://github.com/juicyfx/vercel -examples ) . 👀
124
171
125
172
## 📜 Resources
126
173
@@ -133,25 +180,26 @@ Browse [more examples](https://github.com/juicyfx/now-examples). 👀
133
180
134
181
## 🚧 Roadmap
135
182
136
- - next-gen PHP runtime ✅
183
+ ** WIP**
184
+
185
+ - customize php.ini
186
+ - composer.json scripts
187
+
188
+ ** Done**
189
+
190
+ - next-gen PHP runtime
137
191
- Composer
138
- - config.composer: true ✅
139
- - composer.json detection ✅
140
- - zero config ✅
141
- - ` now dev ` ✅
142
- - rewrite to typescript ✅
143
- - setup CI ✅
144
- - configure php.ini 🚧
145
- - using ` builds.config ` ✅
146
- - using ` build.env ` 🚧
147
- - PHP versions
148
- - 7.4 ✅ (used)
149
- - 7.3 ✅
150
- - 7.2 ✅
192
+ - config.composer: true
193
+ - composer.json detection
194
+ - zero config
195
+ - ` now dev `
196
+ - typescript codebase
197
+ - github workflows (CI)
198
+ - PHP 7.4
151
199
152
200
** Help wanted**
153
201
154
- - create many examples (majority frameworks and other use-cases)
202
+ - create examples using vercel-php
155
203
156
204
## 👨🏻💻CHANGELOG
157
205
0 commit comments