Skip to content

Commit 158e5a5

Browse files
authored
adds front controller samples (GoogleCloudPlatform#674)
1 parent 36fd71b commit 158e5a5

File tree

11 files changed

+2381
-0
lines changed

11 files changed

+2381
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file specifies files that are *not* uploaded to Google Cloud Platform
2+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
3+
# "#!include" directives (which insert the entries of the given .gitignore-style
4+
# file at that point).
5+
#
6+
# For more information, run:
7+
# $ gcloud topic gcloudignore
8+
#
9+
.gcloudignore
10+
# If you would like to upload your .git directory, .gitignore file or files
11+
# from your .gitignore file, remove the corresponding line
12+
# below:
13+
.git
14+
.gitignore
15+
16+
# PHP Composer dependencies:
17+
vendor/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# App Engine for PHP 7.2 Front Controller sample
2+
3+
This app demonstrates how to implement a simple front controller for legacy
4+
projects. The main code sample lies in [`index.php`](index.php#L13). This is one
5+
example of a front controller. See here for more examples:
6+
7+
* [front controller implementation using the Slim Framework](../slim-framework/index.php#L26)
8+
* [front controller implementation for WordPress](../wordpress/files/gae-app.php#L3)
9+
* [front controller implementation using regular expressions](../grpc/index.php#L11)
10+
11+
## Setup
12+
13+
- Install the [Google Cloud SDK](https://developers.google.com/cloud/sdk/).
14+
15+
## Deploy
16+
17+
### Run Locally
18+
19+
You can run the sample locally using PHP's build-in web server:
20+
21+
```
22+
# Run PHP's built-in web server
23+
php -S localhost:8000
24+
```
25+
26+
Browse to `localhost:8000` to see a list of examples to execute.
27+
28+
### Deploy with gcloud
29+
30+
Deploy the samples by doing the following:
31+
32+
```
33+
gcloud config set project YOUR_PROJECT_ID
34+
gcloud app deploy
35+
gcloud app browse
36+
```
37+
38+
The last command will open `https://{YOUR_PROJECT_ID}.appspot.com/`
39+
in your browser. Browse to `/` to see a list of examples to execute.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
runtime: php72
2+
3+
# Defaults to "serve public/index.php" and "serve index.php". Can be used to
4+
# serve a custom PHP front controller (e.g. "serve backend/index.php") or to
5+
# run a long-running PHP script as a worker process (e.g. "php worker.php").
6+
#
7+
# entrypoint: serve index.php
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"require-dev": {
3+
"phpunit/phpunit": "^5",
4+
"google/cloud-tools": "^0.8.1"
5+
}
6+
}

0 commit comments

Comments
 (0)